Skip to content

✨ Quality: Create multi-stage Dockerfile for building and serving the application#169

Open
lukebaze wants to merge 1 commit intoMrXujiang:masterfrom
lukebaze:contribai/improve/quality/create-multi-stage-dockerfile-for-buildi
Open

✨ Quality: Create multi-stage Dockerfile for building and serving the application#169
lukebaze wants to merge 1 commit intoMrXujiang:masterfrom
lukebaze:contribai/improve/quality/create-multi-stage-dockerfile-for-buildi

Conversation

@lukebaze
Copy link
Copy Markdown

Problem

The existing Dockerfile needs to be replaced with a proper multi-stage build that handles both the frontend build process and production serving. This will reduce image size and improve security by separating build and runtime environments.

Severity: high
File: Dockerfile

Solution

Create a multi-stage Dockerfile with: Stage 1 (builder) using Node.js 16-alpine to install dependencies and build the frontend with Umi.js; Stage 2 (production) using Node.js 16-alpine to serve the built application. Include proper environment variables for NODE_ENV, PORT configuration. Add health check endpoint. Copy server.js and dist folder from builder stage. Expose port 3000. Set proper working directory and user permissions for security.

Changes

  • Dockerfile (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

Closes #162

…application

The existing Dockerfile needs to be replaced with a proper multi-stage build that handles both the frontend build process and production serving. This will reduce image size and improve security by separating build and runtime environments.

Affected files: Dockerfile

Signed-off-by: 0xKermini <67284748+lukebaze@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Complete Docker support for easy selfhosting without dependencies issues

1 participant