Setting up continuous deployment

pull/35/head
David Négrier 2 years ago
parent 6bec8b3703
commit bc7b5fc6c9
  1. 65
      .github/workflows/build-and-deploy.yml
  2. 4
      back/.dockerignore
  3. 8
      back/Dockerfile
  4. 19
      deeployer.json
  5. 3
      front/.dockerignore
  6. 9
      front/Dockerfile

@ -0,0 +1,65 @@
name: Build, push and deploy Docker image
on:
push:
branches:
- master
- cd
# tags:
# - '*'
# Enables BuildKit
env:
DOCKER_BUILDKIT: 1
jobs:
build-front:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: "Build and push front image"
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: thecodingmachine/workadventure-front
tag_with_ref: true
add_git_labels: true
working-directory: "front"
build-back:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: "Build and push back image"
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: thecodingmachine/workadventure-back
tag_with_ref: true
add_git_labels: true
working-directory: "back"
deeploy:
needs:
- build-front
- build-back
runs-on: ubuntu-latest
- name: Checkout
uses: actions/checkout@v2
- name: "Deploy"
uses: thecodingmachine/deeployer@master

@ -0,0 +1,4 @@
/dist/
/node_modules/
/dist/bundle.js
/yarn-error.log

@ -0,0 +1,8 @@
FROM thecodingmachine/nodejs:12
COPY . .
RUN yarn install
ENV NODE_ENV=production
CMD ['yarn', 'run', 'prod']

@ -0,0 +1,19 @@
{
"$schema": "https://raw.githubusercontent.com/thecodingmachine/deeployer/master/deeployer.schema.json",
"containers": {
"back": {
"image": "",
"host": "http://api.workadventure.test.thecodingmachine.com",
"env": {
"SECRET_KEY": "tempSecretKeyNeedsToChange"
}
},
"front": {
"image": "",
"host": "http://workadventure.test.thecodingmachine.com",
"env": {
"API_URL": "http://api.workadventure.test.thecodingmachine.com"
}
}
}
}

@ -0,0 +1,3 @@
/node_modules/
/dist/bundle.js
/yarn-error.log

@ -0,0 +1,9 @@
# we are rebuilding on each deploy to cope with the API_URL environment URL
FROM thecodingmachine/nodejs:12-apache
COPY . .
RUN yarn install
ENV NODE_ENV=production
ENV STARTUP_COMMAND_1="yarn run build"
ENV APACHE_DOCUMENT_ROOT=dist/
Loading…
Cancel
Save