Skip to content

Commit e05e3da

Browse files
committed
Remove manual build step
Run `npm run build` while building the container. The compiled artifact is removed from the checked-in code, and added to .gitignore. Bug: T396991
1 parent fc5fbba commit e05e3da

File tree

4 files changed

+16
-184
lines changed

4 files changed

+16
-184
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Dockerfile
2-
docker-compose.yml
2+
docker-compose.yml
3+
node_modules

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ terraform.tfstate*
2020
.terraform*
2121
tofu/kube.config
2222
ansible/collections/*
23+
quarry/web/static/templates/compiled.js

Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,21 @@ RUN pip install --break-system-packages --upgrade pip==24.0 wheel && \
1717
pip install --break-system-packages -r requirements.txt
1818

1919
# Copy app code
20-
USER quarry
2120
COPY . /app
2221

22+
# Build JS assets
23+
RUN apt update && \
24+
apt install -y nodejs npm && \
25+
npm install && \
26+
npm run build && \
27+
# Once the build is run, dependencies are no longer needed, delete them
28+
# to keep image small
29+
rm -rf node_modules && \
30+
apt remove -y nodejs npm && \
31+
rm -rf /var/lib/apt/lists/*
32+
33+
USER quarry
34+
2335
# Expose port for web server
2436
EXPOSE 5000
2537

quarry/web/static/templates/compiled.js

Lines changed: 0 additions & 182 deletions
This file was deleted.

0 commit comments

Comments
 (0)