-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
37 lines (24 loc) · 941 Bytes
/
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
FROM golang:1.14.2-alpine3.11 as builder
WORKDIR /go/src/app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download
# Copy the source from the current directory to the Working Directory inside the container
COPY . .
# There is a problem with net lib bindings and CGO_ENABLED is needed
# https://stackoverflow.com/questions/36279253/go-compiled-binary-wont-run-in-an-alpine-docker-container-on-ubuntu-host
RUN CGO_ENABLED=0 go build -o file-qrs -v .
# ==============================
# Stage 2: Run the isolated build in a lightweight image
# ==============================
FROM alpine:3.11
WORKDIR /app
EXPOSE 8100
ARG HTPASSWD_FILE
ENV HTPASSWD_FILE ${HTPASSWD_FILE:-""}
ENTRYPOINT ["/app/file-qrs"]
CMD ["-p", "8100", "-d", "/files"]
COPY web/ ./web
COPY --from=builder /go/src/app/file-qrs ./
VOLUME /files