-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (33 loc) · 1.24 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
42
43
44
45
46
ARG BASE_IMAGE
FROM golang AS go-builder
WORKDIR $GOPATH/src/app
# Force the go compiler to use modules
ENV GO111MODULE=on
# We want to populate the module cache based on the go.{mod,sum} files.
COPY go.mod .
COPY go.sum .
# This is the ‘magic’ step that will download all the dependencies that are specified in
# the go.mod and go.sum file.
# Because of how the layer caching system works in Docker, the go mod download
# command will _ only_ be re-run when the go.mod or go.sum file change
# (or when we add another docker instruction this line)
RUN go mod download
# ADD . . blows up the build cache. Avoid using it when possible and predictable.
COPY cmd cmd
COPY internal internal
COPY pkg pkg
RUN CGO_ENABLED=0 go build -tags debug -o /dist/server -v -i -ldflags="-s -w" ./cmd/server
FROM $BASE_IMAGE
RUN apt-get update && \
apt-get install -y graphicsmagick --no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY scripts/run-chrome.sh run-chrome.sh
COPY scripts/start-server.sh start-server.sh
RUN /bin/sh run-chrome.sh
ENV DISPLAY=:99
ENV LD_LIBRARY_PATH=/usr/local/lib
COPY --from=go-builder /dist /bin/
## Hack to remove default browser check in chrome
ENTRYPOINT ["/app/start-server.sh"]