-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
40 lines (32 loc) · 1.1 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
# Use an official Node.js runtime as a parent image
FROM ubuntu:22.04
RUN apt-get update && apt-get install curl -y
RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash - &&\
apt-get install -y nodejs
# Set the working directory to /app
WORKDIR /app
# Define environment variables
ARG DB_HOST
ARG DB_PORT
ARG DB_NAME
ARG DB_USERNAME
ARG DB_PASSWORD
# Copy the .env.template file
COPY .env.example .env
# Define the command to run the server
RUN sed -i "s|johndoe|${DB_USERNAME}|" .env && \
sed -i "s|randompassword|${DB_PASSWORD}|" .env && \
sed -i "s|localhost|${DB_HOST}|" .env && \
sed -i "s|3306|${DB_PORT}|" .env && \
sed -i "s|pepper|${DB_NAME}|" .env
# Install dependencies
COPY package*.json tsconfig.json ./
RUN npm install
#RUN npm install prisma --save-dev
# Copy the rest of the application files
COPY . .
# Make port available to the world outside this container
ENV PORT=5000
ENV REDIS_URL=redis://redis:6379
EXPOSE $PORT
CMD npx prisma migrate deploy --schema ./src/prisma/schema.prisma && npx prisma generate --schema=./src/prisma/schema.prisma && npm run build && npm run start