mirror of
https://git.evilfox.cc/test2/wg.git
synced 2026-07-31 20:03:22 +00:00
29 lines
843 B
Docker
29 lines
843 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
FROM golang:1.26-alpine AS builder
|
|
WORKDIR /src
|
|
RUN apk add --no-cache git ca-certificates
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o /out/wg-panel ./cmd/server
|
|
|
|
FROM alpine:3.21
|
|
WORKDIR /app
|
|
RUN apk add --no-cache ca-certificates tzdata curl
|
|
COPY --from=builder /out/wg-panel /app/wg-panel
|
|
COPY migrations /app/migrations
|
|
COPY web /app/web
|
|
COPY wg.sql /data/wg.sql
|
|
ENV APP_ROOT=/app \
|
|
MIGRATIONS_DIR=/app/migrations \
|
|
TEMPLATES_DIR=/app/web/templates \
|
|
STATIC_DIR=/app/web/static \
|
|
MYSQL_DUMP_PATH=/data/wg.sql \
|
|
APP_PORT=8080
|
|
EXPOSE 8080
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=40s --retries=3 \
|
|
CMD curl -fsS http://127.0.0.1:8080/healthz >/dev/null || exit 1
|
|
USER nobody
|
|
CMD ["/app/wg-panel"]
|