Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First Iteration of CI/CD workflow #89

Merged
merged 4 commits into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions zubhub_backend/.github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Backend Production Deployment

on:
push:
branches:
- phase2
paths:
- "zubhub_backend/**"
- "!zubhub_backend/.gitignore"
- "!zubhub_backend/.env.example"
- "!zubhub_backend/.dockerignore"

jobs:
path-context:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Checkout files
uses: actions/checkout@v2

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: zubhub_backend/
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/386
push: true
tags: unstructured/zubhub-backend:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
41 changes: 41 additions & 0 deletions zubhub_frontend/zubhub/.github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Frontend Production Deployment

on:
push:
branches:
- phase2
paths:
- 'zubhub_frontend/zubhub/**'
- '!zubhub_frontend/zubhub/README.md'
- '!zubhub_frontend/zubhub/.env.example'
- '!zubhub_frontend/zubhub/.prettierrc.yaml'
- '!zubhub_frontend/zubhub/.gitignore'

jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Checkout files
uses: actions/checkout@v2

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: zubhub_frontend/zubhub/
file: ./Dockerfile.prod
platforms: linux/amd64,linux/arm64,linux/386
push: true
tags: unstructured/zubhub-frontend:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
16 changes: 5 additions & 11 deletions zubhub_frontend/zubhub/docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
version: "3.3"
version: '3.3'

services:
zubhub_frontend:
container_name: zubhub_frontend
build:
context: .
<<<<<<< HEAD
dockerfile: Dockerfile
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
=======
dockerfile: Dockerfile.prod
volumes:
- ./nginx/prod/default.conf:/etc/nginx/conf.d/default.conf
>>>>>>> e27329f26fe2cff77464c3965a2859d1d6c0b01f
restart: on-failure
ports:
- "80"
- '80'

reverse-proxy:
image: valian/docker-nginx-auto-ssl:1.0.0
Expand All @@ -28,9 +22,9 @@ services:
volumes:
- ./.ssl-data:/etc/resty-auto-ssl
environment:
ALLOWED_DOMAINS: "(zubhub|www.zubhub).unstructured.studio"
SITES: "zubhub.unstructured.studio=zubhub_frontend;www.zubhub.unstructured.studio=zubhub_frontend"
FORCE_HTTPS: "true"
ALLOWED_DOMAINS: '(zubhub|www.zubhub).unstructured.studio'
SITES: 'zubhub.unstructured.studio=zubhub_frontend;www.zubhub.unstructured.studio=zubhub_frontend'
FORCE_HTTPS: 'true'
depends_on:
- zubhub_frontend

Expand Down
8 changes: 2 additions & 6 deletions zubhub_frontend/zubhub/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.3"
version: '3.3'

services:
zubhub_frontend:
Expand All @@ -10,8 +10,4 @@ services:
- ./nginx/dev/default.conf:/etc/nginx/conf.d/default.conf
restart: on-failure
ports:
<<<<<<< HEAD
- "80:80"
=======
- "3000:3000"
>>>>>>> e27329f26fe2cff77464c3965a2859d1d6c0b01f
- '3000:3000'