diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..d0fbc97088a781eb98956f3d026687e53d40d45e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +node/ +frontend/ +backend/ diff --git a/backend b/backend index 13d2641b2df01052ed742ec436c9bed3df36c9f0..f789b573c6f01f2496c7d8eb1b0e5c7082bbf6dc 160000 --- a/backend +++ b/backend @@ -1 +1 @@ -Subproject commit 13d2641b2df01052ed742ec436c9bed3df36c9f0 +Subproject commit f789b573c6f01f2496c7d8eb1b0e5c7082bbf6dc diff --git a/docker-compose-production.yml b/docker-compose-production.yml deleted file mode 100644 index 2f229e0ae72c8199189cf3936aab2eb36fbf10b5..0000000000000000000000000000000000000000 --- a/docker-compose-production.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: "2" - -volumes: - database: - driver: local - website: - -services: - # Build the frontend with node into a Docker volume - # This container does nothing useful beside providing an - # assets container to the nginx service - frontend: - image: villas-web - volumes: - - website:/usr/src/app/build - - nginx: - image: nginx:stable-alpine - ports: - - "80:80" - - "443:443" - volumes: - - website:/www - - ./etc/nginx:/etc/nginx/conf.d/ - - # The VILLASweb backend - backend: - image: villas-backend - environment: - - NODE_ENV=production - restart: always - - # The MongoDB database for the VILLASweb backend - database: - image: mongo:latest - user: mongodb - volumes: - - database:/data/db - restart: always - user: mongodb - - # AMQP broker for VILLAScontroller -# broker: -# image: rabbitmq:management -# environment: -# RABBITMQ_DEFAULT_USER: "villas" -# RABBITMQ_DEFAULT_PASS: "s3c0sim4!" -# ports: -# - "8080:15672" -# - "5672:5672" -# networks: -# villas: - - # VILLASnode, the gateway between UDP and WebSocket traffic - node: - image: villas/node - privileged: true - restart: always - command: node /etc/villas/node/websocket-demo.conf - volumes: - - ./etc/node:/etc/villas/node/ diff --git a/docker-compose.yml b/docker-compose.yml index 57419b91ec8dd788bf0e3a37b7bfabb46ff25e33..46a4cf3226e116b6f40cd319f480eb319e8c80cd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,26 +3,28 @@ version: "2" volumes: database: driver: local - website: services: - # Build the frontend with node into a Docker volume - # This container does nothing useful beside providing an - # assets container to the nginx service frontend: + image: villas/web-frontend build: context: frontend - volumes: - - website:/usr/src/app/build # The VILLASweb backend backend: + image: villas/web-backend build: context: backend environment: - NODE_ENV=production + ports: + - "4000:4000" restart: always + # The nginx image is created with multi stage build + # We first run a nodejs container to build the reactjs app + # The the build results are copied together with the NGinx + # configuration file to a new nginx image. nginx: build: context: . @@ -30,8 +32,6 @@ services: ports: - "80:80" - "443:443" - volumes: - - website:/www # The MongoDB database for the VILLASweb backend database: @@ -51,7 +51,6 @@ services: restart: always command: node /etc/villas/node/websocket-demo.conf volumes: - - /villas:/villas - ./etc/node:/etc/villas/node # Web Interface for MongoDB diff --git a/etc/nginx/villas.conf b/etc/nginx/villas.conf index d738a4bc7fc19a0ec23256795df9e36966994554..a6978806c4a4b71db101ccc53033083040de5977 100644 --- a/etc/nginx/villas.conf +++ b/etc/nginx/villas.conf @@ -31,20 +31,6 @@ server { # frontend location location / { - root /www; - index index.html; - - try_files $uri $uri/ /index.html; - } - - # error pages - error_page 404 /404.html; - location = /404.html { - root /usr/share/nginx/html; - } - - error_page 500 502 503 504 50x.html; - location = /50x.html { - root /usr/share/nginx/html; + proxy_pass http://frontend:5000/; } } diff --git a/frontend b/frontend index c8b99a21cc5aaaa3ebd06ae6f1645cfe0e1ea563..7b51cfc3f130e348275eb095e222f9bd320d6c6c 160000 --- a/frontend +++ b/frontend @@ -1 +1 @@ -Subproject commit c8b99a21cc5aaaa3ebd06ae6f1645cfe0e1ea563 +Subproject commit 7b51cfc3f130e348275eb095e222f9bd320d6c6c diff --git a/node b/node index 8c881a878a468d007fdb44fcc0ff6d9a6bbf5554..d57785547ca44d21673dab24960b087ac1834a2f 160000 --- a/node +++ b/node @@ -1 +1 @@ -Subproject commit 8c881a878a468d007fdb44fcc0ff6d9a6bbf5554 +Subproject commit d57785547ca44d21673dab24960b087ac1834a2f