Adding docker-compose
authorDavid Négrier <d.negrier@thecodingmachine.com>
Fri, 3 Apr 2020 16:31:11 +0000 (18:31 +0200)
committerDavid Négrier <d.negrier@thecodingmachine.com>
Fri, 3 Apr 2020 16:31:11 +0000 (18:31 +0200)
This first commit contains a docker-compose with:

- front container
- traefik for reverse proxy

back container will be added when ready.

README.md
docker-compose.yaml [new file with mode: 0644]
front/webpack.config.js

index af986d6b995aa07f8aed3b0eef4d5930a577bf19..9aa843fa378d3b2ed6e73b02b3e8550396db8685 100644 (file)
--- a/README.md
+++ b/README.md
@@ -7,3 +7,26 @@ Work Adventure is a web-based collaborative workspace for small to medium teams
 
 In Work Adventure, you can move around your office and talk to your colleagues (using a video-chat feature that is
 triggered when you move next to a colleague).
+
+
+## Getting started
+
+Install Docker.
+
+Run:
+
+```
+docker-compose up
+```
+
+The environment will start.
+
+You should now be able to browse to http://workadventure.localhost/ and see the application.
+
+Note: on some OSes, you will need to add this line to your `/etc/hosts` file:
+
+**/etc/hosts**
+```
+workadventure.localhost 127.0.0.1
+```
+
diff --git a/docker-compose.yaml b/docker-compose.yaml
new file mode 100644 (file)
index 0000000..6ee9394
--- /dev/null
@@ -0,0 +1,25 @@
+version: "3"
+services:
+  reverse-proxy:
+    image: traefik:v2.0
+    command: --api.insecure=true --providers.docker
+    ports:
+      - "80:80"
+      # The Web UI (enabled by --api.insecure=true)
+      - "8080:8080"
+    volumes:
+      - /var/run/docker.sock:/var/run/docker.sock
+
+  front:
+    image: thecodingmachine/nodejs:12
+    environment:
+      HOST: "0.0.0.0"
+      NODE_ENV: development
+      API_URL: http://api.workadventure.localhost
+      STARTUP_COMMAND_1: yarn install
+    command: yarn run start
+    volumes:
+      - ./front:/usr/src/app
+    labels:
+      - "traefik.http.routers.front.rule=Host(`workadventure.localhost`)"
+      - "traefik.http.services.front.loadbalancer.server.port=8080"
index 4053b9d1eb91b2f817c63953aaf4fcd2f5fb36eb..21431e4ca1dcc2acf7f88f0ec9b20d9ecbc08664 100644 (file)
@@ -6,6 +6,8 @@ module.exports = {
     devtool: 'inline-source-map',
     devServer: {
         contentBase: './dist',
+        host: '0.0.0.0',
+        disableHostCheck: true,
     },
     module: {
         rules: [
@@ -26,6 +28,7 @@ module.exports = {
     plugins: [
         new webpack.ProvidePlugin({
             Phaser: 'phaser'
-        })
+        }),
+        new webpack.EnvironmentPlugin(['API_URL'])
     ]
 };