-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (30 loc) · 959 Bytes
/
Dockerfile
File metadata and controls
40 lines (30 loc) · 959 Bytes
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
FROM golang:alpine AS build
ENV CGO_ENABLED=0
WORKDIR /src
COPY . .
RUN go build -o yhoard ./cmd/yhoard
FROM alpine:latest
ARG USER=yhoard
ARG GROUP=yhoard
ARG UID=1111
ARG GID=2222
ENV XDG_CONFIG_HOME=/config
ENV YHOARD_CONFIG=/config/config.yaml
ENV YHOARD_OUTPUT_DIR=/data
RUN apk add -U --no-cache ca-certificates tini \
&& mkdir -p /data $XDG_CONFIG_HOME \
&& addgroup --gid $GID $GROUP \
&& adduser -D -H --gecos "" \
--home "/home" \
--ingroup "$GROUP" \
--uid "$UID" \
"$USER" \
&& chown -R $USER:$GROUP /home /data $XDG_CONFIG_HOME \
&& rm -rf /tmp/* /var/{cache,log}/* /var/lib/apt/lists/*
USER $USER
WORKDIR /data
COPY --from=build --chown=$USER:$GROUP /src/sample-config.yaml /config/config.yaml
COPY --from=build --chown=$USER:$GROUP /src/yhoard /usr/local/bin/
VOLUME /data
ENTRYPOINT ["/sbin/tini", "--", "yhoard"]
CMD ["--help"]