-
Notifications
You must be signed in to change notification settings - Fork 56
/
Dockerfile-prod
44 lines (34 loc) · 1.34 KB
/
Dockerfile-prod
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
ARG GO_VERSION
FROM golang:${GO_VERSION}-alpine AS builder
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh gcc libc-dev
ENV GOPATH /app
RUN mkdir -p /app/src/github.com/darkweak/cmd
RUN mkdir -p /app/src/github.com/darkweak/souin
ADD ./go.* /app/src/github.com/darkweak/souin/
RUN mkdir -p /ssl
ADD ./context /app/src/github.com/darkweak/souin/context
ADD ./pkg /app/src/github.com/darkweak/souin/pkg
ADD ./tests /app/src/github.com/darkweak/souin/tests
ADD ./configuration /app/src/github.com/darkweak/souin/configuration
ADD ./configurationtypes /app/src/github.com/darkweak/souin/configurationtypes
ADD ./helpers /app/src/github.com/darkweak/souin/helpers
ADD ./plugins /app/src/github.com/darkweak/souin/plugins
WORKDIR /app/src/github.com/darkweak/souin
RUN go mod download
WORKDIR /app/src/github.com/darkweak/souin/plugins/souin
RUN go mod download
RUN CGO_ENABLED=0 go build -a \
-tags netgo -ldflags '-w -extldflags "-static"' -o /app/cmd/souin .
EXPOSE 80
FROM alpine:latest AS souin
COPY --from=builder /app/cmd/souin .
COPY --from=builder /app/src/github.com/darkweak/souin/configuration .
RUN mkdir -p /ssl
COPY --from=builder /app/src/github.com/darkweak/souin/plugins/souin/default .
RUN mkdir -p configuration
RUN mv *.yml configuration/
RUN mkdir -p default
RUN mv server.* default/
RUN chmod +x ./souin
CMD ["./souin"]