Skip to content

Commit

Permalink
feat: Dockerfile - fix supervisord, cron build
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesread committed Sep 9, 2024
1 parent ed378df commit f38e79d
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 19 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)"

Expand Down
18 changes: 9 additions & 9 deletions var/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions var/docker/supervisord.conf
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 0 additions & 6 deletions var/docker/supervisord/base.ini

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f38e79d

Please sign in to comment.