Initial commit
This commit is contained in:
30
Dockerfile
Normal file
30
Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy go.mod and go.sum files
|
||||
COPY . .
|
||||
|
||||
# Download all dependencies
|
||||
RUN go mod download
|
||||
|
||||
# Build the Go application
|
||||
RUN make build-linux
|
||||
|
||||
# Use a minimal base image
|
||||
FROM scratch
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the binary from the builder stage
|
||||
COPY --from=builder /app/cmd/backend .
|
||||
COPY --from=builder /app/static ./static
|
||||
COPY --from=builder /app/config.yaml .
|
||||
|
||||
# Expose the application port
|
||||
EXPOSE 8080
|
||||
|
||||
# Command to run the binary
|
||||
CMD ["./backend", "-config", "config.yaml"]
|
||||
Reference in New Issue
Block a user