Skip to content

Commit

Permalink
Merge pull request #257 from Amsterdam/improve--make-requirements
Browse files Browse the repository at this point in the history
improved make requirements by adding a docker update
  • Loading branch information
manilde authored Nov 6, 2023
2 parents a4edfa4 + 987164c commit e2e373a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ RUN git config --global url."https://github.com/".insteadOf [email protected]:
RUN npm --production=false --unsafe-perm ci && \
npm cache clean --force

RUN chown -R node:node /app
USER node
# Upgrade dependencies
FROM builder AS upgrade
# install dependencies
RUN npm ci
RUN npm install -g npm-check-updates
CMD ["ncu", "-u", "--doctor", "--target minor"]

# Test
FROM builder as test
Expand All @@ -29,11 +33,15 @@ RUN npm run test

# Build
FROM builder as build

RUN chown -R node:node /app
USER node

RUN echo "run build"
RUN GENERATE_SOURCEMAP=false npm run build

# Deploy
FROM nginxinc/nginx-unprivileged:mainline-alpine-slim
COPY --from=build /app/build/. /var/www/html/

COPY default.conf /etc/nginx/conf.d/
COPY default.conf /etc/nginx/conf.d/
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# VERSION = 2020.01.29
.PHONY: app

dc = docker-compose
dc = docker compose
run = $(dc) run --rm

help: ## Show this help.
Expand Down Expand Up @@ -38,5 +38,5 @@ undeploy_kubectl:
trivy: ## Detect image vulnerabilities
trivy image --ignore-unfixed nginxinc/nginx-unprivileged:mainline-alpine-slim

requirements: ## Upgrade requirements (in package.json and package-lock.json) to latest versions
npm upgrade
requirements: ## Upgrade dependencies
$(run) upgrade $(ARGS)
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,14 @@ services:
- TZ=Europe/Amsterdam
- BUILD_ARG=acc
command: npm run test

upgrade:
build:
context: .
target: upgrade
environment:
- TZ=Europe/Amsterdam
volumes:
- ./package.json:/app/package.json
- ./package-lock.json:/app/package-lock.json
command: ncu -u --doctor --target minor

0 comments on commit e2e373a

Please sign in to comment.