-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.xlget
50 lines (39 loc) · 1.52 KB
/
Dockerfile.xlget
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
47
48
49
50
FROM --platform=$BUILDPLATFORM golang:1.14-alpine as build-env
# Arguments for build
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
# Install git and certificates
RUN apk update && apk add --no-cache git make ca-certificates && update-ca-certificates
# create user for service
RUN adduser -D -g 'luids' luxlist \
&& mkdir -p /var/lib/luids/xlist/status \
&& mkdir -p /var/lib/luids/xlist/local \
&& mkdir -p /var/cache/luids/xlist \
&& touch /var/lib/luids/xlist/status/.keep \
&& touch /var/lib/luids/xlist/local/whitelist.xlist \
&& touch /var/lib/luids/xlist/local/blacklist.xlist \
&& touch /var/cache/luids/xlist/.keep \
&& chown -R luxlist /var/lib/luids/xlist \
&& chown -R luxlist /var/cache/luids/xlist
WORKDIR /app
## dependences
COPY go.mod .
COPY go.sum .
RUN go mod download
## build
COPY . .
RUN make binaries SYSTEM="$(scripts/go-compile-args)"
## create docker
FROM scratch
LABEL maintainer="Luis Guillén Civera <luisguillenc@gmail.com>"
# Import the user and group files from the builder.
COPY --from=build-env /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build-env /etc/passwd /etc/passwd
COPY --from=build-env /app/bin/xlget /bin/
COPY --from=build-env /app/configs/docker/xlist/* /etc/luids/xlist/
COPY --from=build-env /var/lib/luids /var/lib/luids
COPY --from=build-env /var/cache/luids /var/cache/luids
USER luxlist
VOLUME [ "/etc/luids", "/var/lib/luids/xlist", "/var/cache/luids/xlist" ]
CMD [ "/bin/xlget", "--auto", "--config", "/etc/luids/xlist/xlget.toml" ]