-
Notifications
You must be signed in to change notification settings - Fork 85
/
Dockerfile.e2e
49 lines (34 loc) · 1.36 KB
/
Dockerfile.e2e
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
# this Dockerfile is needed because of @testing-library/cypress
# import in tests-e2e/cypress/support/commands.js
# must be in root to include prisma
# must include all imports from seed: prisma, bcryptjs, faker, next.js...
# 2x smaller size than 16.3 which is in project
FROM cypress/base:16.14.2
WORKDIR /app
# important:
# MUST repeat everything from host
# /app/package.json
# /app/tsconfig.json
# /app/tests-e2e/cypress.json
# /app/tests-e2e/tsconfig.json
COPY tests-e2e/package.json tests-e2e/yarn.lock ./
# important: tsconfig.json parent/child same like on host
COPY tsconfig.json ./
COPY tests-e2e/tsconfig.json ./tests-e2e/tsconfig.json
# add prisma and generate client for seed
COPY prisma ./prisma
# by setting CI environment variable we switch the Cypress install messages
# to small "started / finished" and avoid 1000s of lines of progress messages
# https://github.com/cypress-io/cypress/issues/1243
ENV CI=1
RUN yarn install --frozen-lockfile
# dont clean yarn cache
RUN npx prisma generate
RUN rm -rf prisma
# copy imported files in Cypress tests from next.js app
COPY prisma/seed.js ./prisma/seed.js
COPY lib-client/constants.ts ./lib-client/constants.ts
# verify that Cypress has been installed correctly.
# running this command separately from "cypress run" will also cache its result
# to avoid verifying again when running the tests
RUN npx cypress verify