issue-47 #60
@ -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
|
|
||||||
|
@ -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;"]
|
||||||
|
5
frontend/docker-entrypoint.sh
Normal file
5
frontend/docker-entrypoint.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd /etc/nginx/
|
||||||
|
envsubst '$BACKEND_URL' < nginx.conf.template > nginx.conf
|
||||||
|
exec "$@"
|
@ -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';
|
@ -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";
|
||||||
@ -180,7 +180,7 @@ import { DraggableSchedulerComponent } from './schedules/draggable-scheduler/dra
|
|||||||
// context
|
// context
|
||||||
"API_TOKEN": authService.getAccessToken.bind(authService)
|
"API_TOKEN": authService.getAccessToken.bind(authService)
|
||||||
},
|
},
|
||||||
//basePath: environment.api
|
basePath: environment.api,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
deps: [AuthService],
|
deps: [AuthService],
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
api: "api"
|
api: "http://localhost:8080/api"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user