-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (27 loc) · 1.29 KB
/
Dockerfile
File metadata and controls
35 lines (27 loc) · 1.29 KB
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
FROM node:22.19.0-bookworm
# Support for multi-architecture builds
ARG TARGETARCH
# Set an env variable for the location of the app files
ENV APP_HOME=/opt/node/app
# Install postgres dependencies
RUN apt update -y && \
apt install -y curl ca-certificates && \
install -d /usr/share/postgresql-common/pgdg && \
curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc && \
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \
apt update -y && \
apt install -y postgresql-client-17 && \
apt clean
# update path to include any installed node module executables
RUN echo "export PATH=./node_modules/.bin:\$PATH\n" >> /root/.bashrc
# Create a directory for the server app to run from
RUN mkdir -p $APP_HOME
# Add the project files into the app directory and set as working directory
ADD . $APP_HOME
WORKDIR $APP_HOME
# Install dependencies, build client app, generate server prisma client
RUN npm install && \
npm run build -w client && \
npm run prisma:generate -w server
# Set up default command
CMD ["./node_modules/.bin/pm2-runtime", "npm", "--", "start", "-w", "server"]