Initialize project with basic endpoints.
This commit is contained in:
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
# Use a small Go base image
|
||||
FROM golang:1.22 as builder
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy go mod and sum files
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
# Download dependencies
|
||||
RUN go mod download
|
||||
|
||||
# Copy the rest of the application
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN go build -o your-app-name .
|
||||
|
||||
# Use a small base image for the final container
|
||||
FROM alpine:latest
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /root/
|
||||
|
||||
# Copy the compiled binary from the builder stage
|
||||
COPY --from=builder /app/your-app-name .
|
||||
|
||||
# Expose the port the app runs on
|
||||
EXPOSE 8080
|
||||
|
||||
# Run the binary
|
||||
CMD ["./your-app-name"]
|
||||
Reference in New Issue
Block a user