Merge pull request #16 from bjdgyc/dev

修改docker问题
This commit is contained in:
bjdgyc 2021-04-10 16:49:14 +08:00 committed by GitHub
commit bba2690b3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 18 deletions

View File

@ -9,13 +9,14 @@ RUN npx browserslist@latest --update-db \
# server # server
FROM golang:alpine as builder_golang FROM golang:alpine as builder_golang
ENV GOPROXY=https://goproxy.io \ #TODO 本地打包时使用镜像
GOOS=linux #ENV GOPROXY=https://goproxy.io
ENV GOOS=linux
WORKDIR /anylink WORKDIR /anylink
COPY . /anylink COPY . /anylink
COPY --from=builder_node /web/ui /anylink/server/ui COPY --from=builder_node /web/ui /anylink/server/ui
#本地打包时使用镜像 #TODO 本地打包时使用镜像
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories #RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
RUN apk add --no-cache git RUN apk add --no-cache git
RUN cd /anylink/server;go build -o anylink -ldflags "-X main.COMMIT_ID=$(git rev-parse HEAD)" \ RUN cd /anylink/server;go build -o anylink -ldflags "-X main.COMMIT_ID=$(git rev-parse HEAD)" \
@ -34,9 +35,11 @@ COPY ./server/conf /app/conf
COPY ./server/files /app/files COPY ./server/files /app/files
COPY docker_entrypoint.sh /app/ COPY docker_entrypoint.sh /app/
#本地打包时使用镜像 #TODO 本地打包时使用镜像
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories #RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
RUN apk add --no-cache bash iptables && ls /app RUN apk add --no-cache bash iptables \
&& chmod +x /app/docker_entrypoint.sh \
&& ls /app
EXPOSE 443 8800 EXPOSE 443 8800

View File

@ -130,9 +130,8 @@ systemd 脚本放入:
4. 启动容器 4. 启动容器
```bash ```bash
docker run -itd --privileged \ docker run -itd --name anylink --privileged \
-p 443:443 \ -p 443:443 -p 8800:8800 \
-p 8800:8800 \
--restart=always \ --restart=always \
anylink anylink
``` ```
@ -140,10 +139,9 @@ systemd 脚本放入:
5. 使用自定义参数启动容器 5. 使用自定义参数启动容器
```bash ```bash
docker run -itd --privileged \ docker run -itd --name anylink --privileged \
-e IPV4_CIDR=192.168.10.0/24 \ -e IPV4_CIDR=192.168.10.0/24 \
-p 443:443 \ -p 443:443 -p 8800:8800 \
-p 8800:8800 \
--restart=always \ --restart=always \
anylink -c=/etc/server.toml --admin_addr=:8080 anylink -c=/etc/server.toml --admin_addr=:8080
``` ```

View File

@ -85,5 +85,5 @@ const accountMail = `<p>您好:</p>
</ul> </ul>
</div> </div>
<p> <p>
软件下载地址: https://gitee.com/bjdgyc/anylink-soft/blob/master/README.md 软件下载地址: https://{{.LinkAddr}}/files/info.txt
</p>` </p>`

View File

@ -1,5 +0,0 @@
# Binaries for programs and plugins
*
!.gitignore
!index.html

2
server/files/info.txt Normal file
View File

@ -0,0 +1,2 @@
客户端软件需放置在files目录内
如需要帮助请加QQ群567510628

View File

@ -22,7 +22,7 @@ func LinkHome(w http.ResponseWriter, r *http.Request) {
} }
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
fmt.Fprintln(w, "hello world") fmt.Fprintln(w, "AnyLink 是一个企业级远程办公 sslvpn 的软件,可以支持多人同时在线使用。")
} }
func LinkOtpQr(w http.ResponseWriter, r *http.Request) { func LinkOtpQr(w http.ResponseWriter, r *http.Request) {