| # Use the official Node.js image as the base image | |
| FROM node:20.4 | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Clone repository with secret mount | |
| RUN --mount=type=secret,id=CLONE,mode=0444,required=true \ | |
| git clone https://$(cat /run/secrets/CLONE)@github.com/locmaymo/status-page.git . | |
| # Change ownership and permissions | |
| RUN chown -R node:node /app && \ | |
| chmod -R 755 /app | |
| # Switch to non-root user | |
| USER node | |
| # Install dependencies | |
| RUN npm install | |
| # Start the application | |
| CMD ["npm", "start"] |