Skip to content

Commit 295a4ac

Browse files
author
吴浩麟
committed
使用本地lightsocks-server文件构建docker镜像
1 parent beb773d commit 295a4ac

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

Dockerfile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
FROM alpine:latest
1+
FROM golang:latest as builder
2+
WORKDIR /app
3+
COPY go.mod go.sum ./
4+
RUN go mod download
5+
COPY . .
6+
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o lightsocks-server ./cmd/lightsocks-server
27

8+
FROM alpine:latest
39
LABEL maintainer="gwuhaolin <gwuhaolin@gmail.com>"
4-
510
ENV LIGHTSOCKS_SERVER_PORT 12315
6-
ENV LIGHTSOCKS_VERSION 1.0.8
7-
ENV LIGHTSOCKS_DOWNLOAD_URL https://github.com/gwuhaolin/lightsocks/releases/download/${LIGHTSOCKS_VERSION}/lightsocks_${LIGHTSOCKS_VERSION}_linux_amd64.tar.gz
8-
9-
RUN apk upgrade --update
10-
RUN apk add --no-cache curl tar
11-
RUN curl -SLO ${LIGHTSOCKS_DOWNLOAD_URL}
12-
RUN tar -zxf lightsocks_${LIGHTSOCKS_VERSION}_linux_amd64.tar.gz
13-
RUN apk del curl tar
14-
RUN rm -rf lightsocks-local lightsocks_${LIGHTSOCKS_VERSION}_linux_amd64.tar.gz readme.md
15-
11+
COPY --from=builder /app/lightsocks-server .
1612
EXPOSE ${LIGHTSOCKS_SERVER_PORT}
1713
CMD ./lightsocks-server

0 commit comments

Comments
 (0)