chore(docker): add containerized development setup

This commit is contained in:
2026-09-21 16:59:55 +03:30
parent c54332cd61
commit 6e0b718811
7 changed files with 130 additions and 0 deletions

7
backend/.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
.env
*.db
*.sqlite
*.sqlite3
bin
coverage.out
*.test

36
backend/Dockerfile Normal file
View File

@@ -0,0 +1,36 @@
FROM golang:1.27.1-alpine AS build
WORKDIR /src
ARG GOPROXY=https://package-mirror.liara.ir/repository/go/
ENV GOPROXY=$GOPROXY
COPY go.mod go.sum ./
RUN go mod download
COPY cmd ./cmd
COPY internal ./internal
RUN CGO_ENABLED=0 GOOS=linux go build \
-trimpath \
-ldflags="-s -w" \
-o /out/api \
./cmd/api
FROM alpine:3.22
RUN apk add --no-cache ca-certificates \
&& addgroup -S app \
&& adduser -S -G app app \
&& mkdir /data \
&& chown app:app /data
WORKDIR /app
COPY --from=build /out/api ./api
USER app
EXPOSE 8080
CMD ["./api"]