dockerfiles/anylink/Dockerfile

49 lines
1.4 KiB
Docker
Raw Normal View History

2021-06-08 20:45:26 +08:00
# web
2022-11-10 15:53:48 +08:00
FROM node:16.17.1-alpine3.15 as builder_node
2023-08-08 17:35:40 +08:00
ENV VERSION 0.9.4
2021-06-08 20:45:26 +08:00
WORKDIR /web
COPY ./web /web
2022-04-07 16:33:16 +08:00
RUN yarn install \
&& yarn run build \
2021-06-08 20:45:26 +08:00
&& ls /web/ui
# server
2023-04-26 22:17:10 +08:00
FROM golang:1.19-alpine as builder_golang
2021-06-08 20:45:26 +08:00
#TODO 本地打包时使用镜像
2021-08-26 23:09:52 +08:00
ENV GOPROXY=https://goproxy.io
2021-06-08 20:45:26 +08:00
ENV GOOS=linux
WORKDIR /anylink
COPY . /anylink
COPY --from=builder_node /web/ui /anylink/server/ui
#TODO 本地打包时使用镜像
2021-08-26 23:09:52 +08:00
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
2023-08-16 17:59:38 +08:00
RUN apk add --no-cache git gcc musl-dev curl
RUN cd /anylink/server;go mod tidy;go build -o anylink -ldflags "-X main.CommitId=$(curl -s "https://api.github.com/repos/bjdgyc/anylink/git/refs/tags/v${VERSION}" | grep sha | head -n 1 | cut -d '"' -f 4)" \
2021-06-08 20:45:26 +08:00
&& /anylink/server/anylink tool -v
# anylink
FROM alpine
LABEL maintainer="github.com/bjdgyc"
2023-04-26 22:17:10 +08:00
#ENV IPV4_CIDR="192.168.10.0/24"
2021-06-08 20:45:26 +08:00
WORKDIR /app
COPY --from=builder_golang /anylink/server/anylink /app/
COPY docker_entrypoint.sh /app/
2023-04-26 22:17:10 +08:00
#COPY ./server/bridge-init.sh /app/
2021-07-05 18:23:27 +08:00
COPY ./server/conf /app/conf
2021-12-31 20:21:26 +08:00
COPY ./LICENSE /app/LICENSE
2021-07-05 18:23:27 +08:00
2021-06-08 20:45:26 +08:00
#TODO 本地打包时使用镜像
2021-08-26 23:09:52 +08:00
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
2021-06-08 20:45:26 +08:00
RUN apk add --no-cache bash iptables \
&& chmod +x /app/docker_entrypoint.sh \
&& ls /app
EXPOSE 443 8800
#CMD ["/app/anylink"]
2022-11-10 15:53:48 +08:00
ENTRYPOINT ["/app/docker_entrypoint.sh"]