feat: Dockerfile - fix supervisord, cron build

This commit is contained in:
jamesread 2024-09-09 16:46:19 +01:00
parent ed378df4f1
commit f38e79d198
8 changed files with 35 additions and 19 deletions

View File

@ -15,6 +15,9 @@ EXPOSE 3000
RUN mkdir -p /config
COPY var/docker/entrypoint.sh /app/entrypoint.sh
COPY var/docker/supervisord.conf /etc/supervisord.conf
COPY var/docker/supervisord /app/supervisord_available_configs/
COPY .env.example /config/.env
VOLUME /config
@ -28,10 +31,7 @@ COPY nx.json tsconfig.base.json package.json package-lock.json /app/
COPY apps /app/apps/
COPY libraries /app/libraries/
RUN npm ci --no-fund && npm run build
COPY var/docker/entrypoint.sh /app/entrypoint.sh
COPY var/docker/supervisord/* /app/supervisord_configs/
RUN npm ci --no-fund && npx nx run-many --target=build --projects=frontend,backend,workers,cron
LABEL org.opencontainers.image.title="Postiz App (DevContainer)"

View File

@ -1,36 +1,36 @@
#!/bin/bash
if [[ "$SKIP_CONFIG_CHECK" -ne "true" ]]; then
if [[ "$SKIP_CONFIG_CHECK" != "true" ]]; then
echo "symlinking /config/.env into /app/.env"
if [ ! -f /config/.env ]; then
echo "ERROR: No .env file found in /config/.env"
fi
ln -s /config/env /app/.env
ln -sf /config/.env /app/.env
fi
if [[ "$POSTIZ_APPS" -eq "" ]]; then
echo "POSTIZ_APPS is not set, starting everything!"
POSTIZ_APPS="frontend workers cron"
POSTIZ_APPS="frontend workers cron backend"
fi
mkdir -p /etc/supervisor.d/
cp /app/supervisord_configs/base.conf /etc/supervisor.d/
if [[ "$POSTIZ_APPS" == *"frontend"* ]]; then
cp /app/supervisord_configs/frontend.conf /etc/supervisor.d/
ln -sf /app/supervisord_available_configs/frontend.conf /etc/supervisor.d/
fi
if [[ $POSTIZ_APPS == *"workers"* ]]; then
cp /app/supervisord_configs/workers.conf /etc/supervisor.d/
ln -sf /app/supervisord_available_configs/workers.conf /etc/supervisor.d/
fi
if [[ $POSTIZ_APPS == *"cron"* ]]; then
cp /app/supervisord_configs/cron.conf /etc/supervisor.d/
ln -sf /app/supervisord_available_configs/cron.conf /etc/supervisor.d/
fi
if [[ $POSTIZ_APPS == *"backend"* ]]; then
cp /app/supervisord_configs/backend.conf /etc/supervisor.d/
ln -sf /app/supervisord_available_configs/backend.conf /etc/supervisor.d/
fi
/usr/bin/supervisord

View File

@ -0,0 +1,10 @@
[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
[unix_http_server]
file=/run/supervisord.sock
[include]
files = /etc/supervisor.d/*.conf

View File

@ -3,3 +3,6 @@ directory=/app
command=npm run start:prod
autostart=true
autorestart=false
redirect_stderr=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0

View File

@ -1,6 +0,0 @@
[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0

View File

@ -3,3 +3,6 @@ directory=/app
command=npm run start:prod:cron
autostart=true
autorestart=false
redirect_stderr=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0

View File

@ -3,3 +3,6 @@ directory=/app
command=npm run start:prod:frontend
autostart=true
autorestart=false
redirect_stderr=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0

View File

@ -3,3 +3,6 @@ directory=/app
command=npm run start:prod:workers
autostart=true
autorestart=false
redirect_stderr=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0