-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Dockerfile): first structure of Dockerfile added (#2)
* feat(Dockerfile): create multi-stage dockerfile to test and develop * feat(Dockerfile): build and nginx stages added to dockerfile
- Loading branch information
1 parent
d0387dd
commit eff4cc7
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|