-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.xlget
51 lines (37 loc) · 1.28 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
51
FROM golang:1.14-alpine as build-env
# Arguments for build
ARG arch=amd64
# Set github user and token for private repositories
ARG github_user
ENV github_user=$github_user
ARG github_token
ENV github_token=$github_token
# Install git and certificates
RUN apk update && apk add --no-cache git make ca-certificates && update-ca-certificates
WORKDIR /app
## config git
RUN if [ ! -z "$github_user" ]; then git config --global \
url."https://${github_user}:${github_token}@github.com/".insteadOf \
"https://github.com/"; fi
## dependences
COPY go.mod .
COPY go.sum .
RUN go mod download
## build
COPY . .
RUN make binaries SYSTEM="GOOS=linux GOARCH=${arch}"
## create docker
FROM alpine
LABEL maintainer="Luis Guillén Civera <luisguillenc@gmail.com>"
RUN apk update && apk add --no-cache ca-certificates && update-ca-certificates
# create user for service
RUN adduser -D -g 'luids' luxlist && \
mkdir -p /var/lib/luids/xlist && \
chown luxlist /var/lib/luids/xlist && \
mkdir -p /var/cache/luids/xlist && \
chown luxlist /var/cache/luids/xlist
COPY --from=build-env /app/bin/xlget /bin/
COPY --from=build-env /app/configs/docker/xlget/* /etc/luids/xlist/
USER luxlist
VOLUME [ "/etc/luids", "/var/lib/luids/xlist" ]
CMD [ "/bin/xlget", "--auto", "--config", "/etc/luids/xlist/xlget.toml" ]