chat-with-gpt/Dockerfile

46 lines
882 B
Docker
Raw Normal View History

FROM node:19-alpine AS build
2023-03-14 11:00:40 +00:00
RUN addgroup -S app && adduser -S app -G app
RUN mkdir /app && chown app:app /app
USER app
WORKDIR /app
COPY ./app/package.json ./
COPY ./app/tsconfig.json ./
RUN npm install
COPY ./app/craco.config.js ./craco.config.js
COPY ./app/public ./public
COPY ./app/src ./src
ENV NODE_ENV=production
ENV REACT_APP_AUTH_PROVIDER=local
RUN npm run build
FROM node:19-alpine AS server
2023-03-14 11:00:40 +00:00
RUN addgroup -S app && adduser -S app -G app
WORKDIR /app
COPY ./server/package.json ./
COPY ./server/tsconfig.json ./
2023-03-18 02:05:28 +00:00
RUN apk add --update --no-cache python3 py3-pip make g++ git
2023-03-14 11:00:40 +00:00
RUN npm install
COPY ./server/src ./src
2023-03-14 21:38:56 +00:00
RUN CI=true sh -c "cd /app && mkdir data && npm run start && rm -rf data"
2023-03-14 21:11:18 +00:00
2023-03-14 21:16:40 +00:00
COPY --from=build /app/build /app/public
2023-03-15 19:47:47 +00:00
LABEL org.opencontainers.image.source="https://github.com/cogentapps/chat-with-gpt"
2023-03-15 20:00:43 +00:00
ENV PORT 3000
2023-03-15 19:47:47 +00:00
CMD ["npm", "run", "start"]