lab4: S3-вложения, presigned upload и проверки

This commit is contained in:
Vladislav Kunetskiy
2026-10-21 22:42:48 +03:00
parent d342b2a227
commit 49c2fe3071
79 changed files with 12266 additions and 910 deletions
+14 -5
View File
@@ -19,11 +19,15 @@ WORKDIR /opt
COPY go.mod go.sum ./
RUN go mod download
# The Go compiler spikes well above 1 GiB per package on large dependencies, so
# an unbounded parallel build OOMs small Docker VMs and CI runners. Cap
# parallelism; override with --build-arg GOFLAGS=-p=$(nproc) on a bigger host.
ARG GOFLAGS="-p=2"
# The Go compiler spikes well above 1 GiB per package on large dependencies
# (AWS SDK + pgx + Redis), so an unbounded or even -p=2 build OOMs Docker
# Desktop's default VM. Build one package at a time; override with
# --build-arg GOFLAGS=-p=$(nproc) on a bigger host.
ARG GOFLAGS="-p=1"
ENV GOFLAGS=$GOFLAGS
# Keep the compiler well below Docker Desktop's default VM limit.
ENV GOGC=50
ENV GOMEMLIMIT=1GiB
COPY . .
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
@@ -33,7 +37,11 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
&& CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -trimpath -buildvcs=false -tags timetzdata \
-ldflags="-s -w -X main.version=${VERSION}" \
-o /out/migrate ./cmd/migrate
-o /out/migrate ./cmd/migrate \
&& CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -trimpath -buildvcs=false -tags timetzdata \
-ldflags="-s -w -X main.version=${VERSION}" \
-o /out/s3init ./cmd/s3init
FROM alpine:${ALPINE_VERSION} AS runtime
RUN apk add --no-cache ca-certificates wget \
@@ -42,6 +50,7 @@ RUN apk add --no-cache ca-certificates wget \
COPY --from=build --chown=10001:10001 /out/messenger /usr/local/bin/messenger
COPY --from=build --chown=10001:10001 /out/migrate /usr/local/bin/migrate
COPY --from=build --chown=10001:10001 /out/s3init /usr/local/bin/s3init
COPY --chown=10001:10001 config/dev/config.yaml /etc/messenger/dev/config.yaml
USER 10001:10001