-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
55 lines (42 loc) · 1.13 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
51
52
53
54
55
FROM node:18-alpine3.15 AS backend
ARG NODE_ENV=production
ARG PORT=3000
ARG YOUTUBE_API_KEY=
ARG MONGO_CONNECTION_STRING=
ARG REDIS_CONNECTION_STRING=
# environment variables
ENV NODE_ENV=$NODE_ENV
ENV PORT=$PORT
ENV YOUTUBE_API_KEY=$YOUTUBE_API_KEY
ENV MONGO_CONNECTION_STRING=$MONGO_CONNECTION_STRING
ENV REDIS_CONNECTION_STRING=$REDIS_CONNECTION_STRING
# create project directory
WORKDIR /usr/src/pingu-api
# bundle app source
COPY . .
# install dependencies
# enviroment is development because we use babel
RUN NODE_ENV=development npm install
RUN npm run build
EXPOSE $app_port
CMD ["npm", "run", "start"]
FROM node:18-alpine3.15 AS development
ARG NODE_ENV=development
ARG PORT=3000
ARG YOUTUBE_API_KEY=
ARG MONGO_CONNECTION_STRING=
ARG REDIS_CONNECTION_STRING=
# environment variables
ENV NODE_ENV=$NODE_ENV
ENV PORT=$PORT
ENV YOUTUBE_API_KEY=$YOUTUBE_API_KEY
ENV MONGO_CONNECTION_STRING=$MONGO_CONNECTION_STRING
ENV REDIS_CONNECTION_STRING=$REDIS_CONNECTION_STRING
# create project directory
WORKDIR /usr/src/pingu-api
# bundle app source
COPY . .
# install dependencies
RUN npm install
EXPOSE $app_port
CMD ["npm", "run", "start:dev"]