forked from Place1/wg-access-server
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
56 lines (39 loc) · 970 Bytes
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
### Build stage for the website frontend
FROM node:10 as website
WORKDIR /code
COPY ./website/package.json ./
COPY ./website/package-lock.json ./
# install dependency
RUN npm install
COPY ./website/ ./
RUN npm run build
### Build stage for the website backend server
FROM golang:1.13.8 as server
WORKDIR /code
# Environment variable
ENV GOOS=linux
ENV GARCH=amd64
ENV CGO_ENABLED=0
ENV GO111MODULE=on
COPY ./go.mod ./
COPY ./go.sum ./
RUN go mod download
COPY ./proto/ ./proto/
COPY ./main.go ./main.go
COPY ./internal/ ./internal/
COPY ./pkg/ ./pkg/
RUN go build -o server
### Server
FROM alpine:3.10
# Dependencies and tools
RUN apk add iptables
RUN apk add wireguard-tools
RUN apk add curl
# Environment variable
ENV CONFIG="/config.yaml"
ENV STORAGE_DIRECTORY="/data"
# Copy the final build for the frontend and backend
COPY --from=server /code/server /server
COPY --from=website /code/build /website/build
# Command to start the server
CMD /server