diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..c275992c7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,33 @@ +# Include any files or directories that you don't want to be copied to your +# container here (e.g., local build artifacts, temporary files, etc.). +# +# For more help, visit the .dockerignore file reference guide at +# https://docs.docker.com/engine/reference/builder/#dockerignore-file + +**/.classpath +**/.dockerignore +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.next +**/.cache +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +**/build +**/dist +LICENSE +README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..b4d2df394 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +# syntax=docker/dockerfile:1 + +FROM mcr.microsoft.com/playwright:v1.35.1-jammy + +WORKDIR /usr/src/app + +# Download dependencies as a separate step to take advantage of Docker's caching. + +COPY package.json package-lock.json ./ +COPY packages/core/package.json packages/core/package.json +COPY packages/js/package.json packages/js/package.json +COPY packages/node/package.json packages/node/package.json +COPY packages/realtime-api/package.json packages/realtime-api/package.json +COPY packages/swaig/package.json packages/swaig/package.json +COPY packages/web-api/package.json packages/web-api/package.json +COPY packages/webrtc/package.json packages/webrtc/package.json +COPY scripts/sw-build/package.json scripts/sw-build/package.json +COPY scripts/sw-build-all/package.json scripts/sw-build-all/package.json +COPY scripts/sw-common/package.json scripts/sw-common/package.json +COPY scripts/sw-release/package.json scripts/sw-release/package.json +COPY scripts/sw-test/package.json scripts/sw-test/package.json +COPY internal/e2e-js/package.json internal/e2e-js/package.json +COPY internal/e2e-realtime-api/package.json internal/e2e-realtime-api/package.json +COPY internal/playground-js/package.json internal/playground-js/package.json +COPY internal/playground-realtime-api/package.json internal/playground-realtime-api/package.json +COPY internal/playground-swaig/package.json internal/playground-swaig/package.json +COPY internal/stack-tests/package.json internal/stack-tests/package.json + +# Leverage a cache mount to /root/.npm to speed up subsequent builds. +RUN --mount=type=cache,target=/root/.npm \ + npm ci + +COPY . . + +RUN npm i && \ + npm run build + +CMD ["node"] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 000000000..7c45eeb65 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,20 @@ +services: + e2e-js: + build: + context: . + ipc: host # Using --ipc=host is recommended when using Chrome. Chrome can run out of memory without this flag. + working_dir: /usr/src/app/internal/e2e-js + command: npm run -w=@sw-internal/e2e-js dev -- webrtcCalling.spec.ts + volumes: + - ./:/usr/src/app + + e2e-realtime-api: + build: + context: . + ipc: host # Using --ipc=host is recommended when using Chrome. Chrome can run out of memory without this flag. + working_dir: /usr/src/app/internal/e2e-realtime-api + command: npm run -w=@sw-internal/e2e-realtime-api dev # -- chat.test.ts + env_file: + - internal/e2e-realtime-api/.env + volumes: + - ./:/usr/src/app