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
Next Next commit
Update dockerfile base to node:20-alpine
  • Loading branch information
jcortejoso committed Dec 12, 2023
commit 79845ac3b5cbfc62776ddc07c643ba26d3860e4a
20 changes: 12 additions & 8 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,19 +11,21 @@ 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
Expand All @@ -31,4 +35,4 @@ 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