You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wg-access-server/Dockerfile

57 lines
970 B
Docker

### 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