Skip to content

Commit 58a6fbb

Browse files
committed
fix: don't clobber container's node_modules with host's
1 parent f4807a1 commit 58a6fbb

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ venv
1515
.env
1616
.envs
1717
.envs/*
18+
node_modules

compose/local/ui/Dockerfile

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
# Node version should always match the version in `ui/.nvmrc`
22
FROM node:18
3+
4+
# Set the working directory in the container
35
WORKDIR /app
6+
7+
# Copy package.json and yarn.lock
48
COPY package.json yarn.lock ./
9+
10+
# Install dependencies
11+
# RUN yarn install --frozen-lockfile
512
RUN yarn install
6-
RUN ["git", "config", "--global", "--add", "safe.directory", "/app"]
13+
14+
# Copy the rest of the application code
15+
# Don't need this in the local env, we're mounting the code in the compose file
16+
# COPY . .
17+
18+
# Verify that node_modules exists and has content
19+
RUN ls -la /app/node_modules
20+
21+
# Configure git to trust the /app directory
22+
RUN git config --global --add safe.directory /app
23+
24+
# Don't try to open a browser
725
ENV BROWSER=none
8-
CMD ["yarn", "start", "--host", "0.0.0.0" , "--port", "4000"]
26+
27+
# Expose the port the app runs on
28+
EXPOSE 4000
29+
30+
# Define the command to run the app
31+
CMD ["yarn", "start", "--host", "0.0.0.0", "--port", "4000"]

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ volumes:
88
o: bind
99
minio_data:
1010
driver: local
11+
node_modules:
1112

1213
services:
1314
django: &django
@@ -53,6 +54,7 @@ services:
5354
volumes:
5455
- ./.git:/app/.git:ro
5556
- ./ui:/app
57+
- node_modules:/app/node_modules
5658
depends_on:
5759
- django
5860
environment:

0 commit comments

Comments
 (0)