0
Fork 0
mirror of https://github.com/stonith404/pingvin-share.git synced 2025-01-29 01:28:59 -05:00

chore: move docker entrypoint to seperate script

This commit is contained in:
Elias Schneider 2024-08-11 15:53:56 +02:00
parent 94e2a6110d
commit f1f514dff7
No known key found for this signature in database
GPG key ID: 07E623B294202B6C
2 changed files with 14 additions and 9 deletions

View file

@ -30,13 +30,10 @@ RUN npm run build && npm prune --production
FROM node:20-alpine AS runner
ENV NODE_ENV=docker
# Install Caddy
RUN apk update --no-cache \
&& apk upgrade --no-cache \
&& apk add --no-cache curl caddy
COPY ./Caddyfile /etc/caddy/Caddyfile
WORKDIR /opt/app/frontend
COPY --from=frontend-builder /opt/app/public ./public
COPY --from=frontend-builder /opt/app/.next/standalone ./
@ -49,15 +46,13 @@ COPY --from=backend-builder /opt/app/dist ./dist
COPY --from=backend-builder /opt/app/prisma ./prisma
COPY --from=backend-builder /opt/app/package.json ./
COPY ./Caddyfile /etc/caddy/Caddyfile
COPY ./scripts/docker-entrypoint.sh /opt/app/docker-entrypoint.sh
WORKDIR /opt/app
EXPOSE 3000
# Health check remains unchanged
HEALTHCHECK --interval=10s --timeout=3s CMD curl -f http://localhost:3000/api/health || exit 1
# Application startup updated for Caddy
CMD cp -rn /tmp/img/* /opt/app/frontend/public/img && \
caddy run --config /etc/caddy/Caddyfile 2> caddy.log & \
PORT=3333 HOSTNAME=0.0.0.0 node frontend/server.js & \
cd backend && npm run prod
CMD ["sh", "/opt/app/docker-entrypoint.sh"]

View file

@ -0,0 +1,10 @@
#!/bin/sh
# Start Caddy
caddy start --config /etc/caddy/Caddyfile &
# Run the frontend server
PORT=3333 HOSTNAME=0.0.0.0 node frontend/server.js &
# Run the backend server
cd backend && npm run prod
# Wait for all processes to finish
wait -n