-
-
Notifications
You must be signed in to change notification settings - Fork 239
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (22 loc) · 546 Bytes
/
Copy pathDockerfile
File metadata and controls
26 lines (22 loc) · 546 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
FROM golang AS builder
WORKDIR /src
# Download dependencies
COPY go.mod go.sum /
RUN go mod download
# Add source code
COPY . .
RUN CGO_ENABLED=0 go build -o main .
# Multi-Stage production build
FROM alpine AS production
RUN apk --no-cache add ca-certificates
WORKDIR /app
# Retrieve the binary from the previous stage
COPY --from=builder /src/main .
# Copy static template files
COPY templates templates
# Copy frontend
COPY public public
# Expose port
EXPOSE 3000
# Set the binary as the entrypoint of the container
CMD ["./main", "serve"]