Files
fredy/Dockerfile

39 lines
1016 B
Docker
Raw Normal View History

2025-05-26 13:20:12 +02:00
FROM node:22-slim
2025-05-16 15:03:28 +02:00
WORKDIR /fredy
2025-05-16 14:19:20 +02:00
# Install Chromium and curl without extra recommended packages and clean apt cache
# curl is needed for the health check
2025-05-26 13:20:12 +02:00
RUN apt-get update \
&& apt-get install -y --no-install-recommends chromium curl \
2025-05-26 13:20:12 +02:00
&& rm -rf /var/lib/apt/lists/*
2025-05-16 14:26:39 +02:00
2025-05-16 15:03:28 +02:00
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
2025-05-26 12:07:22 +02:00
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
2025-05-26 13:20:12 +02:00
# Copy lockfiles first to leverage cache for dependencies
2025-10-06 20:21:26 +02:00
COPY package.json yarn.lock .
2025-05-26 13:20:12 +02:00
# Set Yarn timeout, install dependencies and PM2 globally
2025-05-26 12:07:22 +02:00
RUN yarn config set network-timeout 600000 \
&& yarn --frozen-lockfile \
2025-05-26 13:20:12 +02:00
&& yarn global add pm2
2025-05-16 14:26:39 +02:00
2025-05-26 13:20:12 +02:00
# Copy application source and build production assets
2025-10-06 20:21:26 +02:00
COPY . .
RUN yarn build:frontend
2025-05-16 14:04:55 +02:00
2025-10-06 20:21:26 +02:00
# Prepare runtime directories and symlinks for data and config
2025-05-26 13:20:12 +02:00
RUN mkdir -p /db /conf \
2025-10-06 20:21:26 +02:00
&& chown 1000:1000 /db /conf \
&& chmod 777 /db /conf \
2025-05-26 13:20:12 +02:00
&& ln -s /db /fredy/db \
&& ln -s /conf /fredy/conf
EXPOSE 9998
VOLUME /db
VOLUME /conf
2025-05-16 15:03:28 +02:00
2025-05-26 13:20:12 +02:00
# Start application using PM2 runtime
2025-10-07 07:18:45 +02:00
CMD ["pm2-runtime", "index.js"]