File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed
Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change 11# Build stage
22FROM golang:1.23.4-alpine AS builder
3-
43# Set working directory
54WORKDIR /app
6-
75# Copy go mod and sum files first to leverage Docker cache
86COPY go.mod go.sum ./
97RUN go mod download
108COPY .env .env
11-
129# Copy the source code
1310COPY . .
14-
1511# Build the application
1612RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /app/backend ./cmd/server/main.go
1713
1814# Final stage
1915FROM alpine:latest
20-
21- # Update and install ca-certificates for HTTPS
22- RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
23-
16+ # Update and install ca-certificates for HTTPS (using apk instead of apt-get)
17+ RUN apk update && apk add --no-cache ca-certificates && rm -rf /var/cache/apk/*
2418WORKDIR /root/
25-
2619# Copy the binary from builder
2720COPY --from=builder /app/backend /root/backend
28- COPY .env /root/.env
21+ # Copy environment file (note: you had this twice in your original)
2922COPY --from=builder /app/.env /root/.env
30-
3123# Copy config files if needed
3224# COPY --from=builder /app/config /root/config
33-
3425# Expose the port your application runs on
3526EXPOSE 8080
36-
3727# Command to run
38- CMD ["./backend" ]
28+ CMD ["./backend" ]
You can’t perform that action at this time.
0 commit comments