Spaces:
Running
Running
# Use the latest Node.js LTS version | |
FROM node:latest | |
# Install pnpm globally | |
RUN npm install -g pnpm | |
# Set working directory | |
WORKDIR /app | |
# Copy the built application from apps/web/.output | |
COPY .output ./ | |
# Go to server directory and install dependencies | |
WORKDIR /app/server | |
RUN pnpm install | |
# Go back to the app root | |
WORKDIR /app | |
# Create a non-root user for security | |
RUN groupadd -r appuser && useradd -r -g appuser appuser | |
RUN chown -R appuser:appuser /app | |
USER appuser | |
ENV PORT=7860 | |
# Expose the port (you may need to adjust this based on your app's configuration) | |
EXPOSE 7860 | |
# Health check | |
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ | |
CMD node -e "require('http').get('http://localhost:7860/api/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))" | |
# Start the application | |
CMD ["node", "server/index.mjs"] | |