FROM node:18-bullseye-slim # Install Git RUN apt-get update && \ apt-get install -y git # Clone the repository into the /app directory RUN --mount=type=secret,id=GITHUB_SSH_KEY,mode=0444,required=true \ --mount=type=secret,id=GIT_LINK \ git config --global credential.helper '!f() { echo "username=$(cat /run/secrets/GITHUB_SSH_KEY)\npassword=$(cat /run/secrets/GITHUB_SSH_KEY)"; }; f' && \ git clone $(cat /run/secrets/GIT_LINK) /app WORKDIR /app # Install dependencies RUN npm install COPY Dockerfile greeting.md* .env* ./ # Copy files for build and build the app RUN npm run build # Expose the app's port EXPOSE 7860 # Set the NODE_ENV environment variable to production ENV NODE_ENV=production # Start the app CMD [ "npm", "start" ]