Added: Dockerfile, support for configurations from env

This commit is contained in:
KamilM1205 2026-01-04 01:04:20 +04:00
parent ea8ab7c0ed
commit c1ed822293
3 changed files with 117 additions and 10 deletions

29
Dockerfile Normal file
View file

@ -0,0 +1,29 @@
FROM golang:1.25.5-alpine3.23 as build
RUN apk add --no-cache git ca-certificates tzdata
WORKDIR /58team_blog
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o /blog ./cmd/main.go
FROM alpine:3.23 AS deploy
WORKDIR /58team_blog
RUN addgroup -g 1001 -S appuser && \
adduser -u 1001 -S appuser -G appuser
COPY --from=build /blog /blog
RUN chown -R appuser:appuser /blog
USER appuser
EXPOSE 8080
EXPOSE 5432
CMD ["/blog"]