-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (29 loc) · 840 Bytes
/
Copy pathDockerfile
File metadata and controls
43 lines (29 loc) · 840 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Build stage
FROM golang:1.24-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git
# Setup for proxy
RUN go env -w GO111MODULE=on && go env -w GOPROXY=https://goproxy.io,direct
WORKDIR /build
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the binary
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags='-w -s' -o qart .
# Runtime stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /app
# Copy binary from builder
COPY --from=builder /build/qart .
# Copy necessary files
COPY --from=builder /build/conf ./conf
COPY --from=builder /build/views ./views
COPY --from=builder /build/static ./static
# Create storage directories
RUN mkdir -p storage/flag storage/qrsave
EXPOSE 8080
ENTRYPOINT ["./qart"]
CMD ["--prod", "--port", "8080"]