mirror of
https://github.com/coollabsio/coolify.git
synced 2026-10-28 09:34:36 +08:00
fix(docker): reduce production image size
This commit is contained in:
1 parent
e172beaa30
commit
bf007b9d2d
2 files changed
+21
-13
No files matched your search
+2
-3
@@ -33,6 +33,5 @@ docker/coolify-terminal/node_modules
|
||||
/storage/app/debugbar
|
||||
/storage/logs
|
||||
/storage/pail
|
||||
|
||||
|
||||
|
||||
/storage/framework/**
|
||||
!/storage/framework/**/.gitignore
|
||||
@@ -65,6 +65,24 @@ RUN npm run build
|
||||
# =================================================================
|
||||
FROM quay.io/minio/aistor/mc:RELEASE.2026-09-06T02-44-40Z AS minio-client
|
||||
|
||||
# =================================================================
|
||||
# Stage 4: Terminal dependencies (match the production Node.js ABI and libc)
|
||||
# =================================================================
|
||||
FROM serversideup/php:${SERVERSIDEUP_PHP_VERSION} AS terminal-dependencies
|
||||
|
||||
USER root
|
||||
|
||||
RUN apk upgrade && \
|
||||
apk add --no-cache nodejs npm make g++ python3
|
||||
COPY docker/coolify-terminal/package*.json /terminal/
|
||||
RUN --mount=type=cache,target=/root/.npm \
|
||||
npm ci --prefix /terminal && \
|
||||
npm rebuild node-pty --prefix /terminal --update-binary && \
|
||||
rm -rf /terminal/node_modules/node-pty/prebuilds/darwin-* \
|
||||
/terminal/node_modules/node-pty/prebuilds/win32-*
|
||||
COPY docker/coolify-terminal/terminal-server.js /terminal/terminal-server.js
|
||||
COPY docker/coolify-terminal/terminal-utils.js /terminal/terminal-utils.js
|
||||
|
||||
# =================================================================
|
||||
# Final Stage: Production image
|
||||
# =================================================================
|
||||
@@ -112,10 +130,6 @@ RUN --mount=type=cache,target=/var/cache/apk \
|
||||
apk add --no-cache \
|
||||
postgresql${POSTGRES_VERSION}-client \
|
||||
nodejs \
|
||||
npm \
|
||||
make \
|
||||
g++ \
|
||||
python3 \
|
||||
openssh-client \
|
||||
git \
|
||||
git-lfs \
|
||||
@@ -171,12 +185,7 @@ COPY --chown=www-data:www-data changelogs/ ./changelogs/
|
||||
RUN composer dump-autoload
|
||||
|
||||
# Install terminal WebSocket server dependencies
|
||||
COPY docker/coolify-terminal/package*.json /terminal/
|
||||
RUN npm ci --prefix /terminal && \
|
||||
npm rebuild node-pty --prefix /terminal --update-binary
|
||||
COPY docker/coolify-terminal/terminal-server.js /terminal/terminal-server.js
|
||||
COPY docker/coolify-terminal/terminal-utils.js /terminal/terminal-utils.js
|
||||
RUN chown -R www-data:www-data /terminal
|
||||
COPY --from=terminal-dependencies --chown=www-data:www-data /terminal /terminal
|
||||
|
||||
# Configure Nginx and S6 overlay
|
||||
COPY docker/production/etc/nginx/conf.d/custom.conf /etc/nginx/conf.d/custom.conf
|
||||
|
||||
Reference in new issue
Block a user