Files
fredy/Dockerfile

50 lines
1.2 KiB
Docker
Raw Normal View History

2025-05-16 15:03:28 +02:00
FROM node:22
2025-05-16 15:03:28 +02:00
# Install chromium dependencies in a separate layer (cacheable)
RUN apt-get update && apt-get install -y chromium && \
apt-get clean && rm -rf /var/lib/apt/lists/*
2025-05-16 15:03:28 +02:00
# Set working directory
WORKDIR /fredy
2025-05-16 14:19:20 +02:00
2025-05-16 15:03:28 +02:00
# Copy only package.json + yarn.lock for dependency caching
COPY package.json yarn.lock ./
COPY . /fredy
2025-05-16 14:19:20 +02:00
2025-05-16 15:03:28 +02:00
RUN apt-get update && apt-get install -y chromium
2025-05-16 14:26:39 +02:00
2025-05-16 15:03:28 +02:00
# Increase network timeout for npm registry
RUN yarn config set network-timeout 600000 && yarn install
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
2025-05-16 14:26:39 +02:00
2025-05-16 15:03:28 +02:00
# Global tools (cached separately)
# Timeout fix für yarn hinzugefügt
RUN yarn config set network-timeout 600000
2025-05-16 15:03:28 +02:00
RUN yarn install
2025-05-16 15:03:28 +02:00
RUN yarn global add pm2
2025-05-16 14:26:39 +02:00
2025-05-16 15:03:28 +02:00
# Copy application source code (after deps, cache friendly)
COPY . .
2025-05-16 14:26:39 +02:00
2025-05-16 15:03:28 +02:00
# Build step (assuming 'prod' is a build script)
RUN yarn run prod
2025-05-16 14:04:55 +02:00
2025-05-16 15:03:28 +02:00
# Prepare runtime dirs
RUN mkdir /db /conf && \
chown 1000:1000 /db /conf && \
chmod 777 -R /db/ && \
ln -s /db /fredy/db && ln -s /conf /fredy/conf
chown 1000:1000 /db /conf && \
chmod 777 -R /db/ && \
ln -s /db /fredy/db && ln -s /conf /fredy/conf
2025-05-16 15:03:28 +02:00
# Expose port & set runtime command
EXPOSE 9998
2025-05-16 15:03:28 +02:00
CMD ["pm2-runtime", "index.js"]
CMD pm2-runtime index.js
2025-05-15 10:37:21 +02:00