30 lines
568 B
Docker
30 lines
568 B
Docker
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"] |