-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
45 lines (34 loc) · 999 Bytes
/
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
# Dockerfile
#
# -------------------------------------
# Context: Build
FROM node:lts-alpine as build
# Set Working Directory Context
WORKDIR "/starworthy"
# Copy package files
COPY api/package.json .
COPY api/prisma prisma
# Context: Dependencies
FROM build AS dependencies
ARG POSTGRES_PRISMA_URL
ARG POSTGRES_URL_NON_POOLING
# Install Modules
RUN npm install
RUN npm install -g prisma
RUN npm run db:generate
# -------------------------------------
# Context: Builder
FROM dependencies as builder
# Copy necessary files to build starworthy
COPY api/src src
COPY api/tsconfig.json .
# tsc
RUN npm run build
# -------------------------------------
# Context: Release
FROM build AS release
# GET deployment code from previous containers
COPY --from=dependencies /starworthy/node_modules /starworthy/node_modules
COPY --from=builder /starworthy/dist /starworthy/dist
# Running starworthy when the image gets built
CMD ["sh", "-c", "npm start"]