-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (25 loc) · 1.38 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
32
33
34
35
36
37
FROM golang:alpine as goBuilder
LABEL maintainer="AnyMoe https://github.com/anymoe"
ENV GO111MODULE on
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories &&\
apk update &&\
apk add --no-cache ca-certificates git make &&\
go env -w GOPROXY=https://goproxy.io,https://goproxy.cn,direct &&\
go get -v -d github.com/tuna/tunasync/cmd/tunasync ;\
git clone https://github.com/tuna/tunasync.git /go/src/github.com/tuna/tunasync
RUN cd /go/src/github.com/tuna/tunasync && go mod init && make
FROM alpine:edge
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories &&\
apk --no-cache add bash curl wget openssh git rsync ca-certificates ;\
mkdir -p /etc/tunasync /mirrors /var/log/tunasync ;\
git clone https://github.com/tuna/tunasync-scripts/ /mirrors/scripts
RUN addgroup --gid 2001 mirrorgroup ;\
adduser --disabled-password --uid 2101 mirrors mirrorgroup ;\
chown -R mirrors:mirrorgroup /mirrors ;\
chmod 775 /mirrors
COPY --from=goBuilder /go/src/github.com/tuna/tunasync/build /usr/local/bin
COPY conf /etc/tunasync
VOLUME ["/etc/tunasync","/mirrors","/var/log/tunasync"]
EXPOSE 6000
USER mirrors
ENTRYPOINT ["/bin/bash", "-c", "(tunasync manager --config /etc/tunasync/manager.conf &); (tunasync worker --config /etc/tunasync/workers.conf)"]