Skip to content

Commit

Permalink
perf: multi-stage docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlaz committed Oct 2, 2023
1 parent 30266fa commit acc7301
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
**/node_modules/
**/dist/
**/.env*
**/.DS_Store
.yarn/*
!.yarn/patches
!.yarn/plugins
Expand All @@ -9,7 +10,8 @@
!.yarn/versions
.github/
.readme-assets/
sample-apps/react-native/
sample-apps/**
!sample-apps/react/egress-composite/
packages/react-native-sdk/
sample-apps/react/egress-composite/tests/
.styles/
26 changes: 20 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
FROM node:20-bullseye

FROM node:20-alpine as packager
WORKDIR /e2e

COPY ./ ./
COPY sample-apps/ sample-apps/
RUN find sample-apps \! -name "package.json" -mindepth 3 -maxdepth 3 -print | xargs rm -rf

RUN ls && yarn install --inline-builds
COPY packages/ packages/
RUN find packages \! -name "package.json" -mindepth 2 -maxdepth 2 -print | xargs rm -rf

RUN yarn build:react:deps
FROM node:20-bullseye as runner
WORKDIR /e2e

RUN npx playwright install chromium
COPY .yarn/ ./.yarn/
COPY yarn.lock package.json .yarnrc.yml tsconfig.json ./
COPY --from=packager /e2e/packages ./packages
COPY --from=packager /e2e/sample-apps ./sample-apps

RUN yarn install

RUN npx playwright install chromium
RUN npx playwright install-deps

# Copy all sources next
COPY ./packages ./packages
RUN yarn build:react:deps

COPY ./sample-apps/ ./sample-apps/

0 comments on commit acc7301

Please sign in to comment.