-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (26 loc) · 883 Bytes
/
Dockerfile
File metadata and controls
40 lines (26 loc) · 883 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
FROM golang:1.25-alpine AS builder
WORKDIR /src
RUN apk add --no-cache git
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=dev
ARG BUILD_TIME=""
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags "-X main.buildVersion=${VERSION} -X main.buildTime=${BUILD_TIME}" \
-o /out/web-server ./web/server
FROM alpine:3.19
WORKDIR /app
RUN apk add --no-cache ca-certificates nginx
RUN adduser -D -H -u 10001 appuser
COPY --from=builder /out/web-server /app/web-server
COPY web/static /app/web/static
COPY automated-rules /app/automated-rules
COPY templates/markdown.tmpl /app/templates/markdown.tmpl
COPY deploy/nginx.container.conf /etc/nginx/nginx.conf
COPY deploy/container-entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh \
&& chown -R 10001:10001 /app /etc/nginx
EXPOSE 8080
USER 10001
ENTRYPOINT ["/app/entrypoint.sh"]