This commit is contained in:
parent
01470803be
commit
40dc28490f
43
Dockerfile
43
Dockerfile
|
|
@ -1,4 +1,42 @@
|
|||
# syntax=docker/dockerfile:1.6
|
||||
#============================================ storage-api ======================================================
|
||||
# Base stage for shared environment setup
|
||||
FROM node:20-alpine3.20 as s3base
|
||||
RUN apk add --no-cache g++ make python3
|
||||
WORKDIR /app
|
||||
COPY storage_v1.19.1/package.json storage_v1.19.1/package-lock.json ./
|
||||
|
||||
# Dependencies stage - install and cache all dependencies
|
||||
FROM s3base as dependencies
|
||||
RUN npm ci
|
||||
# Cache the installed node_modules for later stages
|
||||
RUN cp -R node_modules /node_modules_cache
|
||||
|
||||
# Build stage - use cached node_modules for building the application
|
||||
FROM s3base as s3build
|
||||
COPY --from=dependencies /node_modules_cache ./node_modules
|
||||
COPY storage_v1.19.1/. .
|
||||
RUN npm run build
|
||||
|
||||
# Production dependencies stage - use npm cache to install only production dependencies
|
||||
FROM s3base as production-deps
|
||||
COPY --from=dependencies /node_modules_cache ./node_modules
|
||||
RUN npm ci --production
|
||||
|
||||
# Final stage - for the production build
|
||||
FROM s3base as s3final
|
||||
ARG VERSION
|
||||
ENV VERSION=$VERSION
|
||||
COPY migrations migrations
|
||||
|
||||
# Copy production node_modules from the production dependencies stage
|
||||
COPY --from=production-deps /app/node_modules node_modules
|
||||
# Copy build artifacts from the build stage
|
||||
COPY --from=s3build /app/dist dist
|
||||
|
||||
#EXPOSE 5000
|
||||
#CMD ["node", "dist/start/server.js"]
|
||||
|
||||
|
||||
#============================================ gotrue build======================================================
|
||||
FROM golang:1.22.3-alpine3.20 as authbuild
|
||||
|
|
@ -272,4 +310,7 @@ RUN ln -s /usr/local/bin/auth /usr/local/bin/gotrue
|
|||
|
||||
ENV GOTRUE_DB_MIGRATIONS_PATH=/usr/local/etc/auth/migrations
|
||||
|
||||
#========================================== storage-api ====================================================
|
||||
#========================================== storage-api ====================================================
|
||||
|
||||
COPY --from=s3final node_modules /supabase/storage-ai/node_modules
|
||||
COPY --from=s3final dist /supabase/storage-ai/dist
|
||||
|
|
@ -37,6 +37,11 @@ autorestart=true
|
|||
stderr_logfile=/var/log/auth.err.log
|
||||
stdout_logfile=/var/log/auth.out.log
|
||||
|
||||
[program:storage-api]
|
||||
command=/bin/bash /supabase/storage-api/wrapper.sh
|
||||
autorestart=true
|
||||
stderr_logfile=/var/log/storage-api.err.log
|
||||
stdout_logfile=/var/log/storage-api.out.log
|
||||
|
||||
# [program:kong]
|
||||
# command=/supabase/kong/docker-entrypoint.sh kong docker-start
|
||||
|
|
@ -58,33 +63,5 @@ stdout_logfile=/var/log/auth.out.log
|
|||
# KONG_PREFIX="/usr/local/kong"
|
||||
|
||||
|
||||
# [program:storage-api]
|
||||
# command=/usr/bin/node /supabase/storage-api/dist/start/server.js
|
||||
# autorestart=true
|
||||
# stderr_logfile=/var/log/storage-api.err.log
|
||||
# stdout_logfile=/var/log/storage-api.out.log
|
||||
# environment=
|
||||
# SERVER_PORT="5000",
|
||||
# AUTH_JWT_SECRET="f023d3db-39dc-4ac9-87b2-b2be72e9162b",
|
||||
# AUTH_JWT_ALGORITHM="HS256",
|
||||
# DATABASE_URL="postgres://postgres:postgres@127.0.0.1:5432/postgres",
|
||||
# DATABASE_POOL_URL="postgresql://postgres:postgres@127.0.0.1:6432/postgres",
|
||||
# DB_INSTALL_ROLES="true",
|
||||
# STORAGE_BACKEND="s3",
|
||||
# STORAGE_S3_BUCKET="supa-storage-bucket",
|
||||
# STORAGE_S3_ENDPOINT="http://127.0.0.1:9000",
|
||||
# STORAGE_S3_FORCE_PATH_STYLE="true",
|
||||
# STORAGE_S3_REGION="us-east-1",
|
||||
# AWS_ACCESS_KEY_ID="supa-storage",
|
||||
# AWS_SECRET_ACCESS_KEY="secret1234",
|
||||
# UPLOAD_FILE_SIZE_LIMIT="524288000",
|
||||
# UPLOAD_FILE_SIZE_LIMIT_STANDARD="52428800",
|
||||
# UPLOAD_SIGNED_URL_EXPIRATION_TIME="120",
|
||||
# TUS_URL_PATH="/upload/resumable",
|
||||
# TUS_URL_EXPIRY_MS="3600000",
|
||||
# IMAGE_TRANSFORMATION_ENABLED="true",
|
||||
# IMGPROXY_URL="http://127.0.0.1:8080",
|
||||
# IMGPROXY_REQUEST_TIMEOUT="15",
|
||||
# S3_PROTOCOL_ACCESS_KEY_ID="625729a08b95bf1b7ff351a663f3a23c",
|
||||
# S3_PROTOCOL_ACCESS_KEY_SECRET="850181e4652dd023b7a98c58ae0d2d34bd487ee0cc3254aed6eda37307425907"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,20 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# 设置环境变量
|
||||
export SERVER_PORT="5000"
|
||||
export AUTH_JWT_SECRET="super-secret-jwt-token-with-at-least-32-characters-long"
|
||||
export AUTH_JWT_ALGORITHM="HS256"
|
||||
export DATABASE_URL="postgres://supabase_admin:postgres@db:5432/postgres"
|
||||
export DATABASE_POOL_URL="postgresql://postgres:postgres@127.0.0.1:6432/postgres"
|
||||
export DB_INSTALL_ROLES="true"
|
||||
export STORAGE_BACKEND="file"
|
||||
|
||||
# 等待 gotrue 服务可用(健康检查)
|
||||
until curl -s http://localhost:9999/ >/dev/null 2>&1; do
|
||||
echo "Waiting for gotrue..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
exec /app/storage ...
|
||||
# 启动 Node 应用
|
||||
exec node /supabase/storage-ai/dist/start/server.js
|
||||
|
|
|
|||
Loading…
Reference in New Issue