/
iezhelev
/
cppsh_micro
Обзор
Документация
Войти
/
iezhelev
/
cppsh_micro
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
Dockerfile.file
41 строка
1010 B
iezhelev
file service port fix
11 июл 2025, 15:12
11 июл 2025, 15:12
c9fc946
Код
Авторство
О чём код?
# file-service/Dockerfile FROM golang:1.22-alpine AS builder WORKDIR /app # Copy only the files needed for dependency resolution COPY go.mod go.sum ./ # Download dependencies RUN go mod download # Copy the rest of the application code COPY . . ##COPY --from=generator /app/generated ./generated/ RUN go mod download RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o file-service ./cmd/file/main.go FROM alpine:latest RUN apk --no-cache add ca-certificates WORKDIR /app COPY --from=builder /app/file-service . # Create a directory for uploads and set permissions # This directory should be mapped to a volume in docker-compose or docker run RUN mkdir -p /app/uploads_data && \ chown -R nobody:nogroup /app/uploads_data && \ chmod -R 777 /app/uploads_data # Using 777 for simplicity in example; in prod, use a dedicated non-root user ENV FILE_STORAGE_PATH=/app/uploads_data ENV FILE_SERVICE_PORT=8073 EXPOSE 8073 # Run as non-root user USER nobody:nogroup CMD ["./file-service"]