FROM node:18-bullseye-slim
RUN apt-get update && \
    apt-get install -y git curl
RUN --mount=type=secret,id=GIT_AUTH,mode=0444,required=true \
    git clone https://$(cat /run/secrets/GIT_AUTH)@git.evulid.cc/cyberes/oai-reverse-proxy-epic-troll.git /app

WORKDIR /app
RUN npm install
COPY Dockerfile greeting.md* .env* ./
RUN npm run build
RUN chown -R node:node /app
EXPOSE 7860
ENV NODE_ENV=production

CMD [ "npm", "start" ]