Merge pull request #35 from thecodingmachine/cd
Installing a continuous deployement environement
This commit is contained in:
commit
d826668273
73
.github/workflows/build-and-deploy.yml
vendored
Normal file
73
.github/workflows/build-and-deploy.yml
vendored
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
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:
|
||||||
|
dockerfile: front/Dockerfile
|
||||||
|
path: front/
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
repository: thecodingmachine/workadventure-front
|
||||||
|
tag_with_ref: true
|
||||||
|
add_git_labels: true
|
||||||
|
|
||||||
|
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:
|
||||||
|
dockerfile: back/Dockerfile
|
||||||
|
path: back/
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
repository: thecodingmachine/workadventure-back
|
||||||
|
tag_with_ref: true
|
||||||
|
add_git_labels: true
|
||||||
|
|
||||||
|
deeploy:
|
||||||
|
needs:
|
||||||
|
- build-front
|
||||||
|
- build-back
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
uses: thecodingmachine/deeployer@master
|
||||||
|
env:
|
||||||
|
KUBE_CONFIG_FILE: ${{ secrets.KUBE_CONFIG_FILE }}
|
||||||
|
AUTOCONNECT: 1
|
||||||
|
with:
|
||||||
|
namespace: workadventure-master
|
5
back/.dockerignore
Normal file
5
back/.dockerignore
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/dist/
|
||||||
|
/node_modules/
|
||||||
|
/dist/bundle.js
|
||||||
|
/yarn-error.log
|
||||||
|
/Dockerfile
|
9
back/Dockerfile
Normal file
9
back/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM thecodingmachine/nodejs:12
|
||||||
|
|
||||||
|
COPY --chown=docker:docker . .
|
||||||
|
RUN yarn install
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
CMD ["yarn", "run", "prod"]
|
||||||
|
|
21
deeployer.json
Normal file
21
deeployer.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/thecodingmachine/deeployer/master/deeployer.schema.json",
|
||||||
|
"containers": {
|
||||||
|
"back": {
|
||||||
|
"image": "thecodingmachine/workadventure-back:cd",
|
||||||
|
"host": "api.workadventure.test.thecodingmachine.com",
|
||||||
|
"ports": [8080],
|
||||||
|
"env": {
|
||||||
|
"SECRET_KEY": "tempSecretKeyNeedsToChange"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"front": {
|
||||||
|
"image": "thecodingmachine/workadventure-front:cd",
|
||||||
|
"host": "workadventure.test.thecodingmachine.com",
|
||||||
|
"ports": [80],
|
||||||
|
"env": {
|
||||||
|
"API_URL": "http://api.workadventure.test.thecodingmachine.com"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
front/.dockerignore
Normal file
4
front/.dockerignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/node_modules/
|
||||||
|
/dist/bundle.js
|
||||||
|
/yarn-error.log
|
||||||
|
/Dockerfile
|
9
front/Dockerfile
Normal file
9
front/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# we are rebuilding on each deploy to cope with the API_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/
|
Loading…
Reference in New Issue
Block a user