This commit is contained in:
2026-03-13 22:33:36 -05:00
parent b0aaf80c60
commit d684240697
4 changed files with 109 additions and 11 deletions

View File

@@ -32,6 +32,9 @@ RUN npm run build
# Stage 3: Production Runtime
FROM node:20-alpine
# Install su-exec and shadow (for usermod/groupmod)
RUN apk add --no-cache su-exec shadow
WORKDIR /app
# Copy backend package files
@@ -48,17 +51,20 @@ COPY --from=backend-builder /app/backend/dist ./dist
COPY --from=frontend-builder /app/frontend/dist ./dist/public
# Create temp upload directory
RUN mkdir -p /app/temp && \
chown -R node:node /app
RUN mkdir -p /app/temp
# Switch to non-root user
USER node
# Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Environment variables (can be overridden via Unraid UI)
ENV NODE_ENV=production
ENV PORT=3000
ENV MAX_FILE_SIZE=10485760
ENV TEMP_DIR=/app/temp
# Environment variables (Unraid defaults and App defaults)
ENV PUID=99 \
PGID=100 \
TZ=UTC \
NODE_ENV=production \
PORT=3000 \
MAX_FILE_SIZE=10485760 \
TEMP_DIR=/app/temp
# Expose port
EXPOSE 3000
@@ -67,5 +73,7 @@ EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
ENTRYPOINT ["docker-entrypoint.sh"]
# Start server
CMD ["node", "dist/index.js"]