Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dockerfile base to node:20-alpine #129

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
40 changes: 31 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
version: 2
version: 2.1

orbs:
browser-tools: circleci/[email protected]

workflows:
version: 2
Expand All @@ -21,7 +24,7 @@ workflows:
node-defaults: &NODE
working_directory: ~/workspace
docker:
- image: circleci/node:10.18-browsers
- image: cimg/node:lts-browsers

checkout-workspace-defaults:
- &CHECKOUT-WORKSPACE
Expand All @@ -33,18 +36,23 @@ jobs:
npm-install:
<<: *NODE
steps:
- browser-tools/install-browser-tools
- checkout
- *CHECKOUT-WORKSPACE
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v2-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: npm install
- v2-dependencies-
- run:
command: |
yarn
environment:
NODE_OPTIONS: --openssl-legacy-provider
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
key: v2-dependencies-{{ checksum "package.json" }}
- persist_to_workspace:
root: .
paths:
Expand All @@ -53,9 +61,14 @@ jobs:
test:
<<: *NODE
steps:
- browser-tools/install-browser-tools
- checkout
- *CHECKOUT-WORKSPACE
- run: npm run test
- run:
command: |
yarn test
environment:
NODE_OPTIONS: --openssl-legacy-provider
- store_test_results:
path: coverage/junit
- store_artifacts:
Expand All @@ -68,16 +81,25 @@ jobs:
lint:
<<: *NODE
steps:
- browser-tools/install-browser-tools
- checkout
- *CHECKOUT-WORKSPACE
- run: npm run lint
- run:
command: |
yarn lint
environment:
NODE_OPTIONS: --openssl-legacy-provider
# Build
build-app:
<<: *NODE
steps:
- browser-tools/install-browser-tools
- checkout
- *CHECKOUT-WORKSPACE
- run: npm run build -- --base-href "./"
- run:
command: yarn build -- --base-href "./"
environment:
NODE_OPTIONS: --openssl-legacy-provider
- store_artifacts:
path: dist
- persist_to_workspace:
Expand Down
22 changes: 13 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Builder
FROM node:13 as builder
FROM node:20-alpine as builder

RUN apk add --no-cache git

ADD . /app
WORKDIR /app
Expand All @@ -9,26 +11,28 @@ RUN yarn

# build
ENV NODE_ENV=production
ENV NODE_OPTIONS=--openssl-legacy-provider
RUN yarn build

# clean
RUN rm -rf ./src ./e2e ./node_modules

# Server
FROM nginx:latest
FROM node:20-alpine
LABEL org.opencontainers.image.authors="[email protected]"

RUN apk add --no-cache nginx && \
apk upgrade --no-cache

EXPOSE 80
RUN apt-get update -y \
&& apt-get install curl -y \
&& curl -sL https://deb.nodesource.com/setup_12.x | /bin/bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*

RUN npm i -g @angular/service-worker
COPY --from=builder /app/dist/ /var/www/app
COPY --from=builder /app/ngsw-config.json /var/www/ngsw-config.json
COPY scripts/ /var/www/scripts
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/http.d/default.conf
ENTRYPOINT \
/var/www/scripts/set-env-variables.js /var/www/app \
&& ngsw-config /var/www/app/ /var/www/ngsw-config.json / \
&& nginx -g "daemon off;"; \
/bin/bash
/bin/sh
Loading