diff --git a/Dockerfile b/Dockerfile index 3e78de8..81ee384 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,9 +25,6 @@ FROM node:20-alpine WORKDIR /usr/src/app -RUN apk add sudo -RUN echo '%node ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers - ARG CLIENT_PORT=5001 ENV PORT=5000 @@ -40,26 +37,21 @@ ENV SMTP_PORT=2500 ENV SMTP_USER=fake_mail_user ENV SMTP_PASS=fake_mail_password -COPY package.json . -COPY --from=builder /usr/src/app/client/out ./client/out +COPY --chown=node package.json . +COPY --chown=node --from=builder /usr/src/app/client/out ./client/out +COPY --chown=node server/package.json server/package-lock.json ./server/ -COPY server/package.json server/package-lock.json ./server/ RUN npm ci --omit=dev --prefix server -COPY --from=builder /usr/src/app/server/index.js ./server/index.js -COPY --from=builder /usr/src/app/server/node_modules/.prisma ./server/node_modules/.prisma -COPY --from=builder /usr/src/app/server/prisma ./server/prisma -RUN apk --no-cache add curl -COPY --from=builder /usr/src/app/data ./data +COPY --chown=node --from=builder /usr/src/app/server/index.js ./server/index.js +COPY --chown=node --from=builder /usr/src/app/server/node_modules/.prisma ./server/node_modules/.prisma +COPY --chown=node --from=builder /usr/src/app/server/prisma ./server/prisma +COPY --chown=node --from=builder /usr/src/app/data ./data -RUN chown -R node:node /usr/src/app - -HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD curl -f http://localhost:$PORT/health && curl -f http://localhost:$CLIENT_PORT || exit 1 +HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD wget --quiet --spider http://127.0.0.1:$PORT/health && wget --quiet --spider http://127.0.0.1:$CLIENT_PORT || exit 1 EXPOSE ${PORT} ${CLIENT_PORT} VOLUME ["/usr/src/app/data"] USER node -ENTRYPOINT ["sh", "-c", "sudo chown -R node /usr/src/app/data && ls -l /usr/src/app && exec \"$@\"", "--"] - CMD ["npm", "start"]