add(infra): docker build

This commit is contained in:
maotovisk 2025-08-08 19:04:07 -03:00
parent 5adada0422
commit 84bd8355d6
10 changed files with 79 additions and 303 deletions

30
Dockerfile Normal file
View file

@ -0,0 +1,30 @@
FROM golang:1.24-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 build -o maot-shortner ./cmd/maot-shortner
FROM alpine:latest
RUN apk add --no-cache ca-certificates sqlite-libs
WORKDIR /app
COPY --from=builder /app/maot-shortner .
COPY --from=builder /app/web/static ./web/static
RUN mkdir -p /app/data
EXPOSE 3032
ENV DATABASE_PATH=/app/data/shortener.db
VOLUME ["/app/data"]
CMD ["./maot-shortner"]