dockerfile created

This commit is contained in:
nquidox 2025-09-30 15:33:00 +03:00
parent e5713dd67e
commit 392cdbfd4d
2 changed files with 39 additions and 0 deletions

5
.dockerignore Normal file
View file

@ -0,0 +1,5 @@
.idea
.gitignore
api.env
gen-swag.sh
migrations.sql

34
Dockerfile Normal file
View file

@ -0,0 +1,34 @@
FROM golang:1.25.1-alpine3.22 AS builder
RUN apk add --no-cache \
bash \
curl \
git \
ca-certificates
RUN apk add --no-cache tzdata
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main ./cmd
FROM alpine:3.22
RUN apk add --no-cache \
bash \
curl \
ca-certificates \
tzdata
COPY --from=builder /app/main /usr/local/bin/app
RUN chmod +x /usr/local/bin/app
RUN adduser -D -s /bin/bash appuser
USER appuser
ENTRYPOINT ["app"]