0
0
mirror of https://github.com/vx3r/wg-gen-web.git synced 2025-04-05 17:16:52 +00:00
wg-gen-web/Dockerfile

34 lines
715 B
Docker
Raw Normal View History

### Back-End
FROM golang:alpine AS go-base
ENV CGO_ENABLED=0
2020-02-05 04:01:17 +00:00
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
FROM go-base AS build-back
ARG COMMIT="N/A"
2020-02-06 06:07:15 +00:00
COPY . .
RUN go install -ldflags "-w -s -X 'github.com/vx3r/wg-gen-web/version.Version=${COMMIT::7}'" ./cmd/...
2020-01-30 06:45:49 +00:00
### Front-End
FROM node:18-alpine AS node-base
2020-01-30 06:45:49 +00:00
WORKDIR /app
COPY ui/package.json ui/package-lock.json ./
RUN npm ci --no-fund
FROM node-base AS build-front
COPY ui/ .
2020-02-05 04:01:17 +00:00
RUN npm run build
2020-01-30 06:45:49 +00:00
### Final
FROM alpine AS final-base
RUN apk add -U --no-cache ca-certificates
2020-02-05 04:01:17 +00:00
WORKDIR /app
2020-02-06 06:07:15 +00:00
COPY .env .
COPY --from=build-back /go/bin/wg-gen-web .
COPY --from=build-front /app/dist ./ui/dist
RUN chmod +x ./wg-gen-web
2020-01-30 06:45:49 +00:00
EXPOSE 8080
CMD ["/app/wg-gen-web"]