fix(picture): fix health endpoint and port consistency for Docker deployment

Exclude /health from global prefix so healthchecks hit /health instead of
/api/v1/health. Update Dockerfile EXPOSE and healthcheck to use port 3040
matching docker-compose config.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-20 20:54:27 +01:00
parent 15cde622e4
commit 887b60c8c1
3 changed files with 9 additions and 7 deletions

View file

@ -84,12 +84,12 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
WORKDIR /app/apps/picture/apps/backend
# Expose port
EXPOSE 3006
# Expose port (overridden by PORT env var in docker-compose)
EXPOSE 3040
# Health check
# Health check (overridden by docker-compose healthcheck)
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3006/api/health || exit 1
CMD wget --no-verbose --tries=1 --spider http://localhost:${PORT:-3040}/health || exit 1
# Run entrypoint script
ENTRYPOINT ["docker-entrypoint.sh"]

View file

@ -47,8 +47,10 @@ async function bootstrap() {
prefix: '/uploads/',
});
// Set global prefix for API routes
app.setGlobalPrefix('api/v1');
// Set global prefix for API routes, exclude health/metrics
app.setGlobalPrefix('api/v1', {
exclude: ['health', 'metrics'],
});
const port = process.env.PORT || 3006;
await app.listen(port);

View file

@ -1637,7 +1637,7 @@ services:
ports:
- "3040:3040"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3040/api/health"]
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3040/health"]
interval: 30s
timeout: 10s
retries: 3