Skip to content

Commit

Permalink
feat(Dockerfile): first structure of Dockerfile added (#2)
Browse files Browse the repository at this point in the history
* feat(Dockerfile): create multi-stage dockerfile to test and develop

* feat(Dockerfile): build and nginx stages added to dockerfile
  • Loading branch information
aliyaghini authored Aug 12, 2024
1 parent d0387dd commit eff4cc7
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM node:20 AS base

FROM base as test

WORKDIR /app

COPY package*.json ./

RUN npm ci && npm install -g @angular/[email protected]

RUN apt-get update && apt-get install -y \
wget \
gnupg2 \
&& wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ENV CHROME_BIN="/usr/bin/google-chrome"

# TODO: Use cache

COPY . .

RUN npm test --watch=false --browsers=ChromeHeadlessNoSandbox


FROM base as build

WORKDIR /app

COPY . .

RUN npm ci

RUN npm run build


FROM nginx:latest

COPY nginx.conf /etc/nginx/nginx.conf

COPY --from=build /app/dist/nginx-example-app /usr/share/nginx/html


0 comments on commit eff4cc7

Please sign in to comment.