Files
dashboard/backend/Dockerfile
jafreli eceb5da520
Some checks failed
Build and Push Docker Images / build-and-push-backend (push) Successful in 23s
Build and Push Docker Images / build-and-push-frontend (push) Failing after 23s
Update Docker and package
2026-01-31 00:51:55 +01:00

31 lines
740 B
Docker

# Stage 1: Build the Go application
FROM golang:1.25-alpine AS builder
WORKDIR /app
# Copy go.mod and go.sum files to download dependencies
COPY go.mod go.sum ./
RUN go mod download
# Copy the rest of the application source code
COPY . .
# Build the application
# CGO_ENABLED=0 is important for a clean static build for Alpine
# -o main specifies the output file name
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
# Stage 2: Create the final lightweight image
FROM alpine:latest
WORKDIR /root/
# Copy the built binary from the builder stage
COPY --from=builder /app/main .
# Expose port 8080 (you can change this if your app uses a different port)
EXPOSE 8080
# Command to run the executable
CMD ["./main"]