Commit f3ee3927 authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

nginx is now running as a separate docker container

parent 0fe343f7
Pipeline #10904 failed with stage
in 15 seconds
/node_modules
.git
.gitignore
......@@ -3,8 +3,6 @@ FROM node:10.19.0-stretch
RUN useradd -ms /bin/bash mc
WORKDIR /home/mc
RUN apt-get update
RUN apt-get -yq install nginx
# for testing
RUN apt update
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
......@@ -21,10 +19,5 @@ RUN npm install
COPY . .
COPY nginx.conf /etc/nginx/nginx.conf
RUN install -Dv /dev/null /run/nginx/nginx.pid
# workaround to fix the missing binding issue for node-sass
RUN npm rebuild node-sass
# TODO: for some reason, this does not persist?!?!??!
# RUN ionic cordova build browser --prod --release --max-old-space-size=4096
......@@ -5,17 +5,31 @@ services:
build:
context: .
dockerfile: Dockerfile
command: nginx -g "daemon off;"
entrypoint: ionic cordova build browser --prod --release --max-old-space-size=4096
environment:
- CHROME_BIN=google-chrome
ports:
- "8100:8100"
# ports:
# - "8100:8100"
restart: always
stdin_open: true
tty: true
# do not use mounted volume in combination with the node_modules directory being ignored in .dockerignore
# volumes:
# - .:/home/mc/mc_frontend
volumes:
- $PWD/www:/home/mc/mc_frontend/platforms/browser/www
nginx:
command: nginx-debug -g "daemon off;"
image: nginx:alpine
ports:
- "8100:80"
restart: always
volumes:
- $PWD/www:/usr/share/nginx/html
- ./nginx.conf:/etc/nginx/nginx.conf
- ./config.xml:/usr/share/nginx/html/config.xml
depends_on:
- mc_frontend
networks:
default:
external:
......
# /etc/nginx/nginx.conf
user mc;
# Set number of worker processes automatically based on number of CPU cores.
worker_processes auto;
......@@ -24,7 +22,7 @@ events {
http {
server {
listen 8100;
listen 80;
server_name localhost;
#charset koi8-r;
......@@ -32,7 +30,8 @@ http {
#access_log logs/host.access.log main;
location / {
root /home/mc/mc_frontend/platforms/browser/www;
root /usr/share/nginx/html;
# /home/mc/mc_frontend/platforms/browser/www;
index index.html index.htm;
# enable CORS so the cordova files (config.xml) can be accessed from other domains
add_header Access-Control-Allow-Origin *;
......@@ -138,8 +137,4 @@ http {
# Sets the path, format, and configuration for a buffered log write.
access_log /var/log/nginx/access.log main;
# Includes virtual hosts configs.
include /etc/nginx/conf.d/*.conf;
}
......@@ -16,21 +16,6 @@
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<!-- very, very dirty hack to correct the URL for calls to "/config.xml" from the confighelper.js/cordova.js in the cordova-browser package -->
<script>
const open = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function (method, url, async, username, password) {
async = typeof async === 'undefined' ? true : async;
username = username || null;
password = password || null;
if (url === "/config.xml") {
const base = location.protocol.concat('//').concat(window.location.host) + window.location.pathname.split("/").slice(0, -1).join("/");
url = base + url;
}
return open.call(this, method, url, async, username, password);
};
</script>
<!-- H5P integration, can be called using the global H5P variable -->
<script src="assets/dist/js/h5p-standalone-main.min.js"></script>
</head>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment