Skip to content

Commit

Permalink
Do not install node_modules inside client images
Browse files Browse the repository at this point in the history
Signed-off-by: Benoit Donneaux <[email protected]>
  • Loading branch information
btlogy committed Feb 2, 2024
1 parent cf01297 commit a0e6ac5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 46 deletions.
16 changes: 0 additions & 16 deletions client-e2e/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,3 @@ RUN DIRS="/usr/src/app" && \

# Switch to non-root user
USER ${user}

# Switch to the directory where the client code will live
WORKDIR /usr/src/app/client-e2e

# Install the required packages... But not really?
# FIXME: do it or get rid of this block
COPY package.json .
COPY package-lock.json .
#RUN npm install

# Copy the whole context except what is explicitly ignored
# TODO: be explicit instead?
COPY . .

# Start the dev server by default
CMD ["npm", "run", "wdio"]
30 changes: 0 additions & 30 deletions client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,3 @@ ENV PATH="/home/${user}/.cargo/bin:${PATH}"
# Install wasm-pack to build the WebAssembly packages
# FIXME: make it reproducible!
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

# Switch to the parent directory of where the client code will live
# So the modules installed here will be found by the module resolution
# See https://nodejs.org/api/modules.html#all-together
WORKDIR /usr/src/app

RUN npm install @sentry/cli && \
npm cache clean --force 2> /dev/null
ENV SENTRYCLI_SKIP_DOWNLOAD=1
ARG SENTRYCLI_USE_LOCAL=1

# Install the required packages globaly and unsafely
COPY package.json .
COPY package-lock.json .
RUN npm clean-install && \
npm cache clean --force 2> /dev/null

# Add paths to node modules installed above
ENV PATH=/usr/src/app/node_modules/.bin:$PATH

# Switch to the directory where the client code will live
WORKDIR /usr/src/app/client

# Copy the whole context except what is explicitly ignored
# TODO: be explicit instead?
COPY . .

# Start the dev server by default
CMD ["npm", "run", "serve"]
EXPOSE 8080
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ services:
- ./client/.env
volumes:
- ./client:/usr/src/app/client
working_dir: /usr/src/app/client
command: "npm run serve"
ports:
- "8080:8080" # DevServer
- "35729:35729" # LiveReload
Expand Down Expand Up @@ -132,6 +134,8 @@ services:
volumes:
- ./client-e2e:/usr/src/app/client-e2e
- test-downloads:/home/node/downloads
working_dir: /usr/src/app/client-e2e
command: "npm run wdio"
depends_on:
client:
condition: service_started
Expand Down

0 comments on commit a0e6ac5

Please sign in to comment.