forked from mtusi2026/mtusi2026lab4
Добавил загрузку картинок в S3 и проверку доступа к вложениям
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
FROM golang:1.24.7-bookworm AS build
|
||||
ENV CGO_ENABLED=0 GOTOOLCHAIN=auto
|
||||
RUN go install github.com/minio/minio@RELEASE.2025-09-07T16-13-09Z
|
||||
RUN go install github.com/minio/mc@RELEASE.2025-08-13T08-35-41Z
|
||||
FROM debian:bookworm-slim
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=build /go/bin/minio /usr/local/bin/minio
|
||||
COPY --from=build /go/bin/mc /usr/local/bin/mc
|
||||
ENTRYPOINT ["minio"]
|
||||
@@ -0,0 +1 @@
|
||||
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:ListBucket"],"Resource":["arn:aws:s3:::attachments"]},{"Effect":"Allow","Action":["s3:GetObject","s3:PutObject","s3:DeleteObject"],"Resource":["arn:aws:s3:::attachments/original/*"]}]}
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
mc alias set local http://minio:9000 lab-admin "$(cat /run/secrets/s3_root_password)" >/dev/null
|
||||
mc mb --ignore-existing local/attachments
|
||||
mc anonymous set none local/attachments
|
||||
mc admin user add local messenger-api "$(cat /run/secrets/s3_secret_key)" >/dev/null
|
||||
mc admin policy create local messenger-api /bootstrap/api-policy.json
|
||||
mc admin policy attach local messenger-api --user messenger-api
|
||||
Reference in New Issue
Block a user