Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
FROM node:22-alpine

# Set working directory
WORKDIR /usr/src/app

COPY package.json package-lock.json ./
# install curl for reliable health checks and set proper ownership
USER root
RUN apk add --no-cache curl \
&& chown -R node:node /usr/src/app

RUN npm install --only=production --no-cache
# Switch to non-root user
USER node

COPY . .
# Copy package files
COPY --chown=node:node package.json package-lock.json ./

RUN chmod -R 755 /usr/src/app
# Install dependencies
RUN npm install --only=production --no-cache

USER node
# Copy application code
COPY --chown=node:node . .

ENV NODE_ENV=production

ENTRYPOINT ["node", "./visionboard.js"]
EXPOSE 3000

# Add health check using the API health endpoint
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD curl --fail http://localhost:3000/api/v1/__health || exit 1

CMD ["npm", "run", "start"]
15 changes: 14 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,27 @@ services:
- 5432:5432
volumes:
- visionBoard_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "visionBoard", "-d", "dashboard", "-h", "127.0.0.1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s

adminer:
image: adminer
restart: always
depends_on:
- db
db:
condition: service_healthy
ports:
- 8080:8080
healthcheck:
test: ["CMD", "pgrep", "-f", "php"]
interval: 10s
timeout: 5s
retries: 3
start_period: 5s

schema-dump:
image: postgres:17.2
Expand Down