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:
parent
94e2a6110d
commit
f1f514dff7
2 changed files with 14 additions and 9 deletions
13
Dockerfile
13
Dockerfile
|
@ -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"]
|
10
scripts/docker-entrypoint.sh
Normal file
10
scripts/docker-entrypoint.sh
Normal 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
|
Loading…
Add table
Reference in a new issue