Create Dockerfile

This commit is contained in:
jonny 2021-03-30 15:53:13 +08:00 committed by GitHub
parent ac412ea6c7
commit fdca297900
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM golang:alpine as builder
ENV GOPROXY=https://goproxy.io \
GO111MODULE=on \
GOOS=linux
WORKDIR /root/
RUN apk add --no-cache --update bash git g++ nodejs npm \
&& git clone https://github.com/bjdgyc/anylink.git \
&& cd anylink/server \
&& go build -o anylink -ldflags "-X main.COMMIT_ID=$(git rev-parse HEAD)" \
&& cd ../web \
&& npm install \
&& npx browserslist@latest --update-db \
&& npm run build
FROM golang:alpine
LABEL maintainer="www.mrdoc.fun"
COPY --from=builder /root/anylink/server /app/
COPY --from=builder /root/anylink/web/ui /app/ui/
COPY docker/ /app/
WORKDIR /app
RUN apk add --no-cache pwgen bash iptables openssl ca-certificates \
&& rm -f /app/conf/server.toml \
&& chmod +x docker_entrypoint.sh
ENTRYPOINT ["./docker_entrypoint.sh"]