-
Notifications
You must be signed in to change notification settings - Fork 500
/
Dockerfile
50 lines (33 loc) · 1.01 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
FROM node:19-bullseye-slim AS build
RUN apt-get update && \
apt-get install -y \
git
# Set working directory
WORKDIR /app
# Copy package.json and tsconfig.json
COPY ./app/package.json ./
COPY ./app/tsconfig.json ./
# Install Node.js dependencies
RUN npm install
COPY ./app/vite.config.js ./
# Copy public, and src directories
COPY ./app/public ./public
COPY ./app/src ./src
COPY ./app/index.html ./
# Set environment variables
ENV NODE_ENV=production
# Build the application
RUN npm run build
FROM node:19-bullseye-slim AS server
# Set the working directory
WORKDIR /app
COPY ./server/package.json ./server/tsconfig.json ./
# Install Node.js dependencies from package.json
RUN npm install
# Copy the rest of the application code into the working directory
COPY ./server/src ./src
RUN CI=true sh -c "cd /app && npm run start && rm -rf data"
COPY --from=build /app/build /app/public
LABEL org.opencontainers.image.source="https://github.com/cogentapps/chat-with-gpt"
ENV PORT 3000
CMD ["npm", "run", "start"]