diff --git a/Dockerfile b/Dockerfile index 2bc6914..3708627 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,23 +5,22 @@ WORKDIR /app RUN ["npm", "install"] COPY . /app -RUN ["npm", "run", "compile_production" ] -RUN ["npm", "prune","--production"] +RUN npm run compile_production && \ + npm prune --production - -FROM bitnami/node:12-prod AS production +FROM node:lts-alpine AS production ENV NODE_ENV="production" ENV PORT=8000 -RUN ["adduser", "web", "--disabled-password"] +RUN adduser web --disabled-password +USER web +RUN /bin/mkdir -p /home/web/tmp/public COPY --chown=web:web --from=builder /app /app -USER web WORKDIR /app -RUN /bin/mkdir -p /home/web/tmp/public -RUN /bin/cp -r ./public /home/web/tmp/public -RUN /usr/bin/touch /home/web/tmp/.updatePublic +RUN /bin/cp -r ./public /home/web/tmp/public && \ + /bin/touch /home/web/tmp/.updatePublic EXPOSE 8000 diff --git a/bin/entry.sh b/bin/entry.sh index 3cbee5a..93d20e3 100644 --- a/bin/entry.sh +++ b/bin/entry.sh @@ -1,11 +1,9 @@ -#!/bin/bash - cd /app if [ -f "/home/web/tmp/.updatePublic" ]; then - cp -r /home/web/tmp/public /app/public + /bin/cp -rf /home/web/tmp/public /app rm -rf /home/web/tmp/public - rm /home/web/tmp/.updatePublic + rm -f /home/web/tmp/.updatePublic fi node index.js