From 0574cb7d335989be9ef43498d05daa128cdc3ad7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20N=C3=A9grier?= Date: Mon, 1 Jun 2020 16:12:48 +0200 Subject: [PATCH] Adding continuous integration for website --- .github/workflows/build-and-deploy.yml | 23 +++++++++++++++++++++++ deeployer.libsonnet | 13 ++++++++++++- landing_page/Dockerfile | 9 +++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 landing_page/Dockerfile diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 57bebf9..9d63296 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -56,6 +56,29 @@ jobs: tags: ${{ env.GITHUB_REF_SLUG }} add_git_labels: true + build-website: + + runs-on: ubuntu-latest + + steps: + + - name: Checkout + uses: actions/checkout@v2 + + # Create a slugified value of the branch + - uses: rlespinasse/github-slug-action@master + + - name: "Build and push back image" + uses: docker/build-push-action@v1 + with: + dockerfile: landing_page/Dockerfile + path: landing_page/ + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: thecodingmachine/workadventure-website + tags: ${{ env.GITHUB_REF_SLUG }} + add_git_labels: true + deeploy: needs: - build-front diff --git a/deeployer.libsonnet b/deeployer.libsonnet index 3ede250..cb8cf50 100644 --- a/deeployer.libsonnet +++ b/deeployer.libsonnet @@ -19,13 +19,24 @@ "front": { "image": "thecodingmachine/workadventure-front:"+tag, "host": { - "url": url, + "url": "play."+url, "https": "enable" }, "ports": [80], "env": { "API_URL": "https://api."+url } + }, + "website": { + "image": "thecodingmachine/workadventure-website:"+tag, + "host": { + "url": url, + "https": "enable" + }, + "ports": [80], + "env": { + "GAME_URL": "https://play."+url + } } }, "config": { diff --git a/landing_page/Dockerfile b/landing_page/Dockerfile new file mode 100644 index 0000000..d496000 --- /dev/null +++ b/landing_page/Dockerfile @@ -0,0 +1,9 @@ +# we are rebuilding on each deploy to cope with the GAME_URL environment URL +FROM thecodingmachine/nodejs:12-apache + +COPY --chown=docker:docker . . +RUN yarn install + +ENV NODE_ENV=production +ENV STARTUP_COMMAND_1="yarn run build" +ENV APACHE_DOCUMENT_ROOT=dist/ -- 2.25.1