This commit is contained in:
Mariano Z. 2025-05-03 17:36:17 -03:00
commit 682f25edcd
Signed by: marianozunino
GPG key ID: 4C73BAD25156DACE
19 changed files with 1907 additions and 0 deletions

27
Dockerfile Normal file
View file

@ -0,0 +1,27 @@
############################
# STEP 1: Build executable
############################
FROM golang:1.24.1-alpine AS builder
RUN apk add --no-cache git build-base sqlite-dev
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go install github.com/a-h/templ/cmd/templ@latest
RUN templ generate
RUN CGO_ENABLED=1 go build -o ddns-manager .
############################
# STEP 2: Build final image
############################
FROM alpine:latest
RUN apk add --no-cache sqlite-libs ca-certificates tzdata
WORKDIR /app
COPY --from=builder /app/ddns-manager /app/
COPY --from=builder /app/assets /app/assets
VOLUME /data
EXPOSE 3000
ENV DB_PATH=/data/ddns.db
ENTRYPOINT ["/app/ddns-manager"]