autoface commited on
Commit
a7468a9
·
1 Parent(s): 33853cb

feat: Add a Dockerfile, build a Docker image of the Alist application, support optional installation of FFMPEG and Aria2, configure relevant dependencies and environment variables.

Browse files
Files changed (1) hide show
  1. Dockerfile +44 -0
Dockerfile ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM alpine:edge as builder
2
+ LABEL stage=go-builder
3
+ WORKDIR /app/
4
+ RUN apk add --no-cache bash curl gcc git go musl-dev
5
+ RUN git clone https://github.com/AlistGo/alist.git .
6
+ COPY go.mod go.sum ./
7
+ RUN go mod download
8
+ COPY ./ ./
9
+ RUN bash build.sh release docker
10
+
11
+ FROM alpine:edge
12
+
13
+ ARG INSTALL_FFMPEG=false
14
+ ARG INSTALL_ARIA2=false
15
+ LABEL MAINTAINER="i@nn.ci"
16
+
17
+ WORKDIR /opt/alist/
18
+
19
+ RUN apk update && \
20
+ apk upgrade --no-cache && \
21
+ apk add --no-cache bash ca-certificates su-exec tzdata; \
22
+ [ "$INSTALL_FFMPEG" = "true" ] && apk add --no-cache ffmpeg; \
23
+ [ "$INSTALL_ARIA2" = "true" ] && apk add --no-cache curl aria2 && \
24
+ mkdir -p /opt/aria2/.aria2 && \
25
+ wget https://github.com/P3TERX/aria2.conf/archive/refs/heads/master.tar.gz -O /tmp/aria-conf.tar.gz && \
26
+ tar -zxvf /tmp/aria-conf.tar.gz -C /opt/aria2/.aria2 --strip-components=1 && rm -f /tmp/aria-conf.tar.gz && \
27
+ sed -i 's|rpc-secret|#rpc-secret|g' /opt/aria2/.aria2/aria2.conf && \
28
+ sed -i 's|/root/.aria2|/opt/aria2/.aria2|g' /opt/aria2/.aria2/aria2.conf && \
29
+ sed -i 's|/root/.aria2|/opt/aria2/.aria2|g' /opt/aria2/.aria2/script.conf && \
30
+ sed -i 's|/root|/opt/aria2|g' /opt/aria2/.aria2/aria2.conf && \
31
+ sed -i 's|/root|/opt/aria2|g' /opt/aria2/.aria2/script.conf && \
32
+ touch /opt/aria2/.aria2/aria2.session && \
33
+ /opt/aria2/.aria2/tracker.sh ; \
34
+ rm -rf /var/cache/apk/*
35
+
36
+ COPY --from=builder /app/bin/alist ./
37
+ COPY entrypoint.sh /entrypoint.sh
38
+ RUN chmod +x /opt/alist/alist && \
39
+ chmod +x /entrypoint.sh && /entrypoint.sh version
40
+
41
+ ENV PUID=0 PGID=0 UMASK=022 RUN_ARIA2=${INSTALL_ARIA2}
42
+ VOLUME /opt/alist/data/
43
+ EXPOSE 5244 5245
44
+ CMD [ "/entrypoint.sh" ]