1- FROM node:18-bookworm-slim AS build
1+ # Stage 1: Install dependencies
2+ FROM node:22-slim AS build
23
34LABEL maintainer="OpenZiti <openziti@netfoundry.io>"
45
56# Install useful tools
67RUN apt-get update
7- RUN apt-get install -y python3 build-essential
8+ RUN apt-get install -y python3 build-essential curl
89
910# Create directory for the Ziti BrowZer Bootstrapper, and explicitly set the owner of that new directory to the node user
1011RUN mkdir /home/node/ziti-browzer-bootstrapper
@@ -14,28 +15,31 @@ WORKDIR /home/node/ziti-browzer-bootstrapper
1415COPY --chown=node:node package.json ./
1516COPY --chown=node:node yarn.lock ./
1617
17- # Install the dependencies for the Ziti BrowZer Bootstrapper according to yarn.lock (ci) without
18- # devDepdendencies (--production), then uninstall npm which isn't needed.
19- RUN yarn install \
20- && npm cache clean --force --loglevel=error
18+ # Install Yarn 4 globally
19+ RUN corepack enable && corepack prepare yarn@4.0.2 --activate && yarn config set nodeLinker node-modules
2120
2221# Bring in the source of the Ziti BrowZer Bootstrapper to the working folder
2322COPY --chown=node:node index.js .
2423COPY --chown=node:node zha-docker-entrypoint .
2524COPY --chown=node:node lib ./lib/
2625COPY --chown=node:node assets ./assets/
2726
28- FROM node:18-bookworm-slim
27+ # Install dependencies (ensuring node_modules remains)
28+ RUN yarn install
2929
30- RUN apt-get update && apt-get install curl -y
30+ RUN ls -l
3131
32+ # Stage 2: Production-ready image
33+ FROM node:22-slim
34+
35+ WORKDIR /home/node/ziti-browzer-bootstrapper
36+
37+ # Copy installed node_modules from build stage
3238COPY --from=build /home/node/ziti-browzer-bootstrapper /home/node/ziti-browzer-bootstrapper
3339
3440RUN chown -R node:node /home/node/ziti-browzer-bootstrapper
3541USER node
3642
37- WORKDIR /home/node/ziti-browzer-bootstrapper
38-
3943# Expose the Ziti BrowZer Bootstrapper for traffic to be proxied (8000) and the
4044# REST API where it can be configured (8001)
4145EXPOSE 8000
0 commit comments