FROM node:18-bullseye-slim COPY app.js /app/app.js RUN apt-get update && apt-get install -y nginx COPY nginx.conf /etc/nginx/sites-available/default COPY index.html /var/www/html/index.html WORKDIR /app RUN --mount=type=secret,id=COOKIE,mode=0444,required=true \ sed -i "s/xoxd-xxxx/$(cat /run/secrets/COOKIE)/g" app.js RUN --mount=type=secret,id=API_TOKEN,mode=0444,required=true \ sed -i "s/API_TOKEN/$(cat /run/secrets/API_TOKEN)/g" /etc/nginx/sites-available/default # RUN npm install EXPOSE 7860 ENV NODE_ENV=production RUN chown -R node:node /app && chmod -R 755 /app && \ chown -R node:node /var/log/nginx && \ chown -R node:node /var/lib/nginx && \ chown -R node:node /var/www/html && \ chown -R node:node /etc/nginx/conf.d RUN touch /var/run/nginx.pid && \ chown -R node:node /var/run/nginx.pid CMD [ "sh", "-c", "nginx && node app.js" ]