Features: 1) Add Dockerfile for building and running storefront application; 2) Introduce multi-stage build with separation of development and runtime environments; 3) Include environment variable management and non-root user setup;
Fixes: 1) Update dependencies in `package-lock.json` with the latest versions to address compatibility issues; Extra: 1) Remove unused dependencies and redundant package references from `package-lock.json` for optimization; 2) Improve scripts and permission setups in Dockerfile for clarity and security.
This commit is contained in:
parent
dc19e1f0a0
commit
b68911006b
8 changed files with 4169 additions and 3402 deletions
|
|
@ -12,6 +12,7 @@ coverage.*
|
||||||
*.py,cover
|
*.py,cover
|
||||||
nosetests.xml
|
nosetests.xml
|
||||||
desktop.ini
|
desktop.ini
|
||||||
|
tmp/
|
||||||
|
|
||||||
# Cache directories
|
# Cache directories
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
@ -50,6 +51,8 @@ wheels/
|
||||||
share/python-wheels/
|
share/python-wheels/
|
||||||
pip-log.txt
|
pip-log.txt
|
||||||
pip-delete-this-directory.txt
|
pip-delete-this-directory.txt
|
||||||
|
storefront/node_modules/
|
||||||
|
storefront/.nuxt
|
||||||
|
|
||||||
# Git
|
# Git
|
||||||
.git/
|
.git/
|
||||||
|
|
|
||||||
36
Dockerfiles/storefront.Dockerfile
Normal file
36
Dockerfiles/storefront.Dockerfile
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM node:22-bookworm-slim AS build
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV NODE_ENV=development
|
||||||
|
|
||||||
|
COPY ./storefront/package.json ./storefront/package-lock.json ./
|
||||||
|
RUN npm ci --include=optional
|
||||||
|
|
||||||
|
COPY ./storefront ./
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM node:22-bookworm-slim AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV HOST=0.0.0.0
|
||||||
|
ENV PORT=3000
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends curl \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN addgroup --system --gid 1001 nodeapp \
|
||||||
|
&& adduser --system --uid 1001 --ingroup nodeapp --home /home/nodeapp nodeapp
|
||||||
|
USER nodeapp
|
||||||
|
|
||||||
|
COPY --from=build /app/.output/ ./
|
||||||
|
|
||||||
|
RUN install -d -m 0755 -o nodeapp -g nodeapp /home/nodeapp \
|
||||||
|
&& printf '#!/bin/sh\nif [ \"$DEBUG\" = \"1\" ]; then export NODE_ENV=development; else export NODE_ENV=production; fi\nexec node /app/server/index.mjs\n' > /home/nodeapp/start.sh \
|
||||||
|
&& chown nodeapp:nodeapp /home/nodeapp/start.sh \
|
||||||
|
&& chmod +x /home/nodeapp/start.sh
|
||||||
|
|
||||||
|
USER nodeapp
|
||||||
|
CMD ["sh", "/home/nodeapp/start.sh"]
|
||||||
|
|
@ -9,7 +9,7 @@ services:
|
||||||
container_name: app
|
container_name: app
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./Dockerfiles/Dockerfile.app
|
dockerfile: ./Dockerfiles/app.Dockerfile
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
|
|
@ -128,7 +128,7 @@ services:
|
||||||
container_name: worker
|
container_name: worker
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./Dockerfiles/Dockerfile.worker
|
dockerfile: ./Dockerfiles/worker.Dockerfile
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
|
|
@ -156,7 +156,7 @@ services:
|
||||||
container_name: stock_updater
|
container_name: stock_updater
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./Dockerfiles/Dockerfile.stock_updater
|
dockerfile: ./Dockerfiles/stock_updater.Dockerfile
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
|
|
@ -184,7 +184,7 @@ services:
|
||||||
container_name: beat
|
container_name: beat
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./Dockerfiles/Dockerfile.beat
|
dockerfile: ./Dockerfiles/beat.Dockerfile
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
|
|
@ -220,6 +220,29 @@ services:
|
||||||
- --web.config.file=/etc/prometheus/web.yml
|
- --web.config.file=/etc/prometheus/web.yml
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
|
|
||||||
|
storefront:
|
||||||
|
container_name: storefront
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./Dockerfiles/storefront.Dockerfile
|
||||||
|
args:
|
||||||
|
- DEBUG=${DEBUG}
|
||||||
|
restart: always
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=${DEBUG:+development}
|
||||||
|
- NODE_ENV=${DEBUG:-production}
|
||||||
|
- NUXT_HOST=0.0.0.0
|
||||||
|
- NUXT_PORT=3000
|
||||||
|
- NUXT_DEVTOOLS_ENABLED=${DEBUG}
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
depends_on:
|
||||||
|
app:
|
||||||
|
condition: service_started
|
||||||
|
logging: *default-logging
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
es-data:
|
es-data:
|
||||||
|
|
|
||||||
7501
storefront/package-lock.json
generated
7501
storefront/package-lock.json
generated
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue