2023-09-21 11:37:27 +00:00
|
|
|
### Back-End
|
|
|
|
FROM golang:alpine AS go-base
|
|
|
|
ENV CGO_ENABLED=0
|
2020-02-05 04:01:17 +00:00
|
|
|
WORKDIR /app
|
2023-09-21 11:37:27 +00:00
|
|
|
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 . .
|
2023-09-21 11:37:27 +00:00
|
|
|
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
|
|
|
|
2023-09-21 11:37:27 +00:00
|
|
|
### Front-End
|
|
|
|
FROM node:18-alpine AS node-base
|
2020-01-30 06:45:49 +00:00
|
|
|
WORKDIR /app
|
2023-09-21 11:37:27 +00:00
|
|
|
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
|
|
|
|
2023-09-21 11:37:27 +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 .
|
2023-09-21 11:37:27 +00:00
|
|
|
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
|
|
|
|
|
2023-09-21 11:37:27 +00:00
|
|
|
CMD ["/app/wg-gen-web"]
|