Optimise docker context (#32870)
* Optimise docker context Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Optimise docker context further Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Debug Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -1,13 +0,0 @@
|
|||||||
# Exclude a bunch of stuff which can make the build context a larger than it needs to be
|
|
||||||
test/
|
|
||||||
webapp/
|
|
||||||
lib/
|
|
||||||
node_modules/
|
|
||||||
karma-reports/
|
|
||||||
.idea/
|
|
||||||
.tmp/
|
|
||||||
config.json*
|
|
||||||
.link-config
|
|
||||||
# Exclude the playwright directory as much as we can as the snapshots are huge and we bind mount it in
|
|
||||||
playwright/
|
|
||||||
!playwright/docker-entrypoint.sh
|
|
||||||
+8
-3
@@ -1,4 +1,5 @@
|
|||||||
# syntax=docker.io/docker/dockerfile:1.22-labs@sha256:4c116b618ed48404d579b5467127b20986f2a6b29e4b9be2fee841f632db6a86
|
# syntax=docker.io/docker/dockerfile:1.22-labs@sha256:4c116b618ed48404d579b5467127b20986f2a6b29e4b9be2fee841f632db6a86
|
||||||
|
# Context must be the root of the monorepo
|
||||||
|
|
||||||
# Builder
|
# Builder
|
||||||
FROM --platform=$BUILDPLATFORM node:24-bullseye@sha256:4bfbd78e049926e4ca595c1798810691ca7bb5aedd829ffd8a78b2ab30689810 AS builder
|
FROM --platform=$BUILDPLATFORM node:24-bullseye@sha256:4bfbd78e049926e4ca595c1798810691ca7bb5aedd829ffd8a78b2ab30689810 AS builder
|
||||||
@@ -10,11 +11,15 @@ ARG JS_SDK_BRANCH="master"
|
|||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
COPY --exclude=docker . /src
|
# Install dependencies
|
||||||
|
COPY --parents package.json pnpm-lock.yaml pnpm-workspace.yaml patches scripts **/package.json /src/
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
RUN /src/scripts/docker-link-repos.sh
|
RUN --mount=type=bind,source=.git,target=/src/.git /src/scripts/docker-link-repos.sh
|
||||||
RUN pnpm install
|
RUN pnpm install
|
||||||
RUN /src/scripts/docker-package.sh
|
|
||||||
|
# Build
|
||||||
|
COPY --link --exclude=.git --exclude=apps/web/docker . /src
|
||||||
|
RUN --mount=type=bind,source=.git,target=/src/.git /src/scripts/docker-package.sh
|
||||||
|
|
||||||
# Copy the config now so that we don't create another layer in the app image
|
# Copy the config now so that we don't create another layer in the app image
|
||||||
RUN cp /src/apps/web/config.sample.json /src/apps/web/webapp/config.json
|
RUN cp /src/apps/web/config.sample.json /src/apps/web/webapp/config.json
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# Exclude a bunch of stuff which can make the build context a larger than it needs to be
|
||||||
|
**/test/
|
||||||
|
**/*.stories.tsx
|
||||||
|
**/*.test.ts
|
||||||
|
**/*.test.tsx
|
||||||
|
**/lib/
|
||||||
|
**/dist/
|
||||||
|
**/node_modules/
|
||||||
|
**/coverage/
|
||||||
|
**/.pnpm-store
|
||||||
|
**/tsconfig.node.tsbuildinfo
|
||||||
|
**/*.md
|
||||||
|
**/*.rst
|
||||||
|
|
||||||
|
.idea/
|
||||||
|
.tmp/
|
||||||
|
.nx/
|
||||||
|
.link-config
|
||||||
|
|
||||||
|
apps/web/config.json*
|
||||||
|
apps/web/webpack-stats.json
|
||||||
|
apps/web/playwright/
|
||||||
|
apps/web/webapp/
|
||||||
|
apps/web/debian/
|
||||||
|
|
||||||
|
packages/shared-components/__vis__/
|
||||||
|
packages/shared-components/storybook-static/
|
||||||
|
packages/shared-components/typedoc/
|
||||||
Reference in New Issue
Block a user