Skip to content

Commit b25f292

Browse files
authored
Add dockerfile for frontend (#8)
1 parent 61d9a30 commit b25f292

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

frontend/Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM node:latest as build
2+
3+
# Set the working directory
4+
WORKDIR /usr/local/app
5+
6+
# Add the source code to app
7+
COPY ./ /usr/local/app/
8+
9+
# Install all the dependencies
10+
RUN npm install
11+
12+
# Generate the build of the application
13+
RUN npm run build
14+
15+
16+
# Stage 2: Serve app with nginx server
17+
18+
# Use official nginx image as the base image
19+
FROM nginx:latest
20+
21+
# Copy the nginx configuration file to the container
22+
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
23+
24+
# Copy the build output to replace the default nginx contents.
25+
COPY --from=build /usr/local/app/dist/notes-app /usr/share/nginx/html
26+
27+
# Expose port 80
28+
EXPOSE 80

frontend/angular.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"prefix": "app",
1616
"architect": {
1717
"build": {
18-
"builder": "@angular-devkit/build-angular:application",
18+
"builder": "@angular-devkit/build-angular:browser",
1919
"options": {
2020
"outputPath": "dist/notes-app",
2121
"index": "src/index.html",
22-
"browser": "src/main.ts",
22+
"main": "src/main.ts",
2323
"polyfills": [],
2424
"tsConfig": "tsconfig.app.json",
2525
"inlineStyleLanguage": "scss",

frontend/nginx/nginx.conf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
events{}
2+
http {
3+
include /etc/nginx/mime.types;
4+
server {
5+
listen 80;
6+
server_name localhost;
7+
root /usr/share/nginx/html;
8+
index index.html;
9+
location / {
10+
try_files $uri $uri/ /index.html;
11+
}
12+
}
13+
}

frontend/src/environments/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const environment = {
2-
keycloakUrl: '',
2+
keycloakUrl: 'http://localhost:8090',
33
keycloakRealm: 'notes',
44
keycloakClientId: 'notes-client',
55
production: true

0 commit comments

Comments
 (0)