issue-47 #60

Merged
sebastian merged 13 commits from issue-47 into master 2023-11-13 18:54:08 +01:00
6 changed files with 16 additions and 16 deletions
Showing only changes of commit f97ed39bbe - Show all commits

View File

@ -21,8 +21,6 @@ services:
depends_on: depends_on:
- "db" - "db"
restart: always restart: always
ports:
- "8080:8080"
frontend: frontend:
build: build:
context: ./frontend context: ./frontend
@ -35,12 +33,4 @@ services:
ports: ports:
- "4200:80" - "4200:80"
environment: environment:
# change this env-variable in prod BACKEND_URL: http://backend:8080
BACKEND_URL: http://backend/
# alternative way manipulate the api.json:
#{
# "api": "http://backend/"
#}
# bind-mount it read-only via:
#volumes:
# - ./api.json:/usr/share/nginx/html/assets/api.json:ro

View File

@ -12,7 +12,12 @@ RUN apt-get update
RUN apt-get upgrade -y RUN apt-get upgrade -y
RUN apt-get install iputils-ping -y RUN apt-get install iputils-ping -y
COPY --from=build /app/dist/frontend /usr/share/nginx/html COPY --from=build /app/dist/frontend /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf COPY nginx.conf.template /etc/nginx/nginx.conf.template
COPY docker-entrypoint.sh /app-entrypoint.sh
RUN chmod +x /app-entrypoint.sh
ENTRYPOINT [ "/app-entrypoint.sh" ]
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

View File

@ -0,0 +1,5 @@
#!/bin/bash
cd /etc/nginx/
envsubst '$BACKEND_URL' < nginx.conf.template > nginx.conf
exec "$@"

View File

@ -34,7 +34,7 @@ http {
add_header "Access-Control-Allow-Headers" 'X-Requested-With,Accept,Content-Type, Origin'; add_header "Access-Control-Allow-Headers" 'X-Requested-With,Accept,Content-Type, Origin';
location /api { location /api {
proxy_pass http://backend/; proxy_pass ${BACKEND_URL};
add_header "Access-Control-Allow-Origin" "*"; add_header "Access-Control-Allow-Origin" "*";
add_header "Access-Control-Allow-Methods" 'GET, POST, OPTIONS, PUT, DELETE'; add_header "Access-Control-Allow-Methods" 'GET, POST, OPTIONS, PUT, DELETE';
add_header "Access-Control-Allow-Headers" 'X-Requested-With,Accept,Content-Type, Origin'; add_header "Access-Control-Allow-Headers" 'X-Requested-With,Accept,Content-Type, Origin';

View File

@ -6,7 +6,7 @@ import { AppComponent } from './app.component';
import {LoginComponent} from "./auth/login/login.component"; import {LoginComponent} from "./auth/login/login.component";
import {FormsModule, ReactiveFormsModule} from "@angular/forms"; import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import {HttpClient, HttpClientModule, HttpHandler} from "@angular/common/http"; import {HttpClient, HttpClientModule, HttpHandler} from "@angular/common/http";
import {ApiModule, Configuration} from "../api"; import {ApiModule, Configuration, ConfigurationParameters} from "../api";
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {MatToolbarModule} from "@angular/material/toolbar"; import {MatToolbarModule} from "@angular/material/toolbar";
import {MatIconModule} from "@angular/material/icon"; import {MatIconModule} from "@angular/material/icon";
@ -178,7 +178,7 @@ import {MatLegacySliderModule} from "@angular/material/legacy-slider";
// context // context
"API_TOKEN": authService.getAccessToken.bind(authService) "API_TOKEN": authService.getAccessToken.bind(authService)
}, },
//basePath: environment.api basePath: environment.api,
} }
), ),
deps: [AuthService], deps: [AuthService],

View File

@ -4,7 +4,7 @@
export const environment = { export const environment = {
production: false, production: false,
api: "api" api: "http://localhost:8080/api"
}; };
/* /*