-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Docker configuration to use Nginx and adjust port mapping
- Loading branch information
Showing
3 changed files
with
22 additions
and
21 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
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 |
---|---|---|
@@ -1,25 +1,26 @@ | ||
FROM node:20.17.0 AS build | ||
WORKDIR /app | ||
|
||
RUN npm install -g @angular/cli@18.2.12 | ||
|
||
COPY package*.json ./ | ||
RUN npm install | ||
|
||
COPY . . | ||
|
||
RUN npm run build -- --configuration production | ||
|
||
FROM node:20.17.0 | ||
WORKDIR /app | ||
|
||
RUN npm install -g @angular/cli@18.2.12 | ||
|
||
COPY --from=build /app/dist /app/dist | ||
COPY package*.json ./ | ||
|
||
RUN npm install --production | ||
|
||
EXPOSE 4200 | ||
# Todo: change the way to run | ||
CMD npx http-server ./dist/frontend --port 4200 --host 0.0.0.0 | ||
RUN npm run build --prod | ||
|
||
FROM nginx:1.21.3-alpine | ||
COPY --from=build /app/dist/frontend /usr/share/nginx/html | ||
|
||
RUN echo 'server {\ | ||
listen 80;\ | ||
listen [::]:80;\ | ||
server_name localhost;\ | ||
location / {\ | ||
root /usr/share/nginx/html/browser;\ | ||
try_files $uri $uri/ /index.html;\ | ||
index index.html index.htm;\ | ||
}\ | ||
error_page 500 502 503 504 /50x.html;\ | ||
location = /50x.html {\ | ||
root /usr/share/nginx/html/browser;\ | ||
}\ | ||
}' > /etc/nginx/conf.d/default.conf |
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