diff --git a/Dockerfile.dev b/Dockerfile.dev index 95e34a5c3..0162b4efb 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -14,17 +14,20 @@ ENV NPM_CONFIG_UPDATE_NOTIFIER=false ENV NEXT_TELEMETRY_DISABLED=1 RUN apk add --no-cache \ + caddy \ bash=5.2.21-r0 \ supervisor=4.2.5-r4 WORKDIR /app -EXPOSE 4200 EXPOSE 3000 +EXPOSE 4200 +EXPOSE 5000 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 var/docker/Caddyfile /app/Caddyfile COPY .env.example /config/postiz.env VOLUME /config diff --git a/var/docker/Caddyfile b/var/docker/Caddyfile new file mode 100644 index 000000000..d539a52f8 --- /dev/null +++ b/var/docker/Caddyfile @@ -0,0 +1,9 @@ +:5000/ { + handle_path /api/* { + reverse_proxy * localhost:3000 + } + + handle { + reverse_proxy * localhost:4200 + } +} diff --git a/var/docker/entrypoint.sh b/var/docker/entrypoint.sh index df3b13fdc..e2914d747 100755 --- a/var/docker/entrypoint.sh +++ b/var/docker/entrypoint.sh @@ -5,8 +5,8 @@ set -o xtrace if [[ "$SKIP_CONFIG_CHECK" != "true" ]]; then echo "Entrypoint: Copying /config/postiz.env into /app/.env" - if [ ! -f /config/.env ]; then - echo "Entrypoint: WARNING: No .env file found in /config/postiz.env" + if [ ! -f /config/postiz.env ]; then + echo "Entrypoint: WARNING: No postiz.env file found in /config/postiz.env" fi cp -vf /config/postiz.env /app/.env @@ -22,6 +22,11 @@ npm run prisma-db-push mkdir -p /etc/supervisor.d/ +if [[ "$INTERNAL_PROXY_ENABLED" != "false" ]]; then + echo "Entrypoint: Starting internal proxy" + cp -vf /app/supervisord_available_configs/caddy.conf /etc/supervisor.d/ +fi + if [[ "$POSTIZ_APPS" == *"frontend"* ]]; then ln -sf /app/supervisord_available_configs/frontend.conf /etc/supervisor.d/ fi diff --git a/var/docker/supervisord/caddy.conf b/var/docker/supervisord/caddy.conf new file mode 100644 index 000000000..f697d0ad6 --- /dev/null +++ b/var/docker/supervisord/caddy.conf @@ -0,0 +1,8 @@ +[program:backend] +directory=/app +command=caddy run --config /app/Caddyfile +autostart=true +autorestart=false +redirect_stderr=true +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0