-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (36 loc) · 1.15 KB
/
Dockerfile
File metadata and controls
45 lines (36 loc) · 1.15 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
36
37
38
39
40
41
42
43
44
45
FROM node:20-alpine AS build-stage
WORKDIR /usr/src/app
# Setup
RUN apk update && apk add openssh && apk add openssl
RUN npm install -g pnpm
# Install node_modules
COPY package.json .
COPY pnpm-lock.yaml .
COPY prisma ./prisma
RUN pnpm install --frozen-lockfile
# Copy source code
COPY . .
# The DATABASE_URL is needed in the build step to run
# prisma migrations. The CI pipeline has a temporary
# postgres service for this purpose.
ARG DATABASE_URL
# NEXT_PUBLIC environment variables cannot be provided
# at runtime, therefore they are inserted at build time.
ARG NEXT_PUBLIC_STRIPE_TESTMODE_PUBLISHABLE_KEY
ARG NEXT_PUBLIC_AZURE_BLOB_STORAGE_URL
ARG NEXT_PUBLIC_URL_PROD
ARG NEXT_PUBLIC_AZURE_BLOB_CONTAINER_NAME
ARG SKIP_ENV_VALIDATION
# Printing the build args makes debugging configs easier
RUN echo $DATABASE_URL
RUN echo $SKIP_ENV_VALIDATION
RUN echo $NEXT_PUBLIC_STRIPE_TESTMODE_PUBLISHABLE_KEY
RUN echo $NEXT_PUBLIC_AZURE_BLOB_STORAGE_URL
RUN echo $NEXT_PUBLIC_AZURE_BLOB_CONTAINER_NAME
RUN echo $NEXT_PUBLIC_URL_PROD
# Run prisma migrations
RUN pnpm prisma generate
RUN pnpm prisma migrate deploy
# Build
RUN pnpm build
CMD ["sh", "/usr/src/app/startup.sh"]