-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
41 lines (28 loc) · 1.04 KB
/
Dockerfile
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
# ==============================================================================
# First stage build (compile the Go server)
# ==============================================================================
FROM alpine:3.7 as builder
RUN apk add --no-cache go musl-dev
WORKDIR /
COPY web/main.go .
RUN GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o server .
# ==============================================================================
# Second stage build
# ==============================================================================
FROM alpine:3.7
RUN apk add --no-cache nginx s6
# Copy s6 configuration
ADD s6 /s6
RUN chmod +x -R /s6 && \
mkdir -p /run/nginx && \
mkdir /web && \
ln -sf /dev/stdout /var/log/nginx/access.log && \
ln -sf /dev/stderr /var/log/nginx/error.log
# Copy the internal server from the first stage build
COPY --from=builder /server /web/
# Copy server config
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/default.conf /etc/nginx/conf.d/
STOPSIGNAL SIGTERM
EXPOSE 443
CMD ["s6-svscan", "/s6"]