fix dockerfile and use external config.js

This commit is contained in:
mroxso 2023-11-05 20:37:54 +01:00
parent 52d92de8fa
commit 685e80e639
3 changed files with 6 additions and 6 deletions

View File

@ -19,9 +19,9 @@ WORKDIR /usr/src/app
# Leverage a bind mounts to package.json and package-lock.json to avoid having to copy them into # Leverage a bind mounts to package.json and package-lock.json to avoid having to copy them into
# into this layer. # into this layer.
RUN --mount=type=bind,source=package.json,target=package.json \ RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \ # --mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm \ --mount=type=cache,target=/root/.npm \
npm ci --omit=dev npm i --omit=dev
# Run the application as a non-root user. # Run the application as a non-root user.
USER node USER node

View File

@ -48,10 +48,8 @@ tmux new -d "node index.js"
``` ```
git clone https://github.com/mroxso/bostr git clone https://github.com/mroxso/bostr
cd bostr cd bostr
npm i docker build -t bostr:local .
cp config.js.example config.js docker run --rm --name bostr -p 8080:8080 -v ./config.js:/usr/src/app/config.js bostr:local
docker build -t bostr:local
docker run --rm --name bostr -p 8080:8080 bostr:local
``` ```
## License ## License

View File

@ -13,6 +13,8 @@ services:
context: . context: .
environment: environment:
NODE_ENV: production NODE_ENV: production
volumes:
- ./config.js:/usr/src/app/config.js
ports: ports:
- 8080:8080 - 8080:8080