-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
31 lines (30 loc) · 1 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
## Build first
FROM golang:latest as builder
RUN mkdir /builddir
ADD go.mod go.sum /builddir/
ADD cmd /builddir/cmd
ADD config /builddir/config
ADD crypto /builddir/crypto
ADD model /builddir/model
ADD bot /builddir/bot
WORKDIR /builddir
RUN go mod download
RUN go mod tidy
RUN go mod verify
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-w -s -extldflags "-static"' -o arrgo \
github.com/wneessen/arrgo/cmd/arrgo
## Create scratch image
FROM scratch
LABEL maintainer="[email protected]"
COPY ["docker-files/passwd", "/etc/passwd"]
COPY ["docker-files/group", "/etc/group"]
COPY ["arrgo.toml.example", "/arrgo/etc/arrgo.toml"]
COPY --from=builder ["/etc/ssl/certs/ca-certificates.crt", "/etc/ssl/cert.pem"]
COPY --chown=arrgo ["LICENSE", "/arrgo/LICENSE"]
COPY --chown=arrgo ["README.md", "/arrgo/README.md"]
COPY --from=builder --chown=arrgo ["/builddir/arrgo", "/arrgo/arrgo"]
ADD --chown=arrgo sql_migrations /arrgo/sql_migrations
WORKDIR /arrgo
USER arrgo
VOLUME ["/arrgo/etc"]
ENTRYPOINT ["/arrgo/arrgo"]