Skip to content

Merge pull request #30 from OZ-Coding-School/dev #35

Merge pull request #30 from OZ-Coding-School/dev

Merge pull request #30 from OZ-Coding-School/dev #35

Workflow file for this run

name: customk deploy
on:
push:
branches:
- main
jobs:
push_to_registry:
name: Push to ncp container registry
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Inject .env file
run: echo "${{ secrets.ENV_PROD }}" > ./.env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to NCP Container Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.NCP_CONTAINER_REGISTRY }}
username: ${{ secrets.NCP_ACCESS_KEY }}
password: ${{ secrets.NCP_SECRET_KEY }}
- name: Build and push app image
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ secrets.NCP_CONTAINER_REGISTRY }}/customk-app:${{ github.run_number }}
${{ secrets.NCP_CONTAINER_REGISTRY }}/customk-app:latest
cache-from: type=registry,ref=${{ secrets.NCP_CONTAINER_REGISTRY }}/customk-app:latest
cache-to: type=inline
- name: Prepare nginx.conf with server_name
run: |
export SERVER_NAME=${{ secrets.SERVER_NAME }}
envsubst '${SERVER_NAME}' < ./nginx/nginx.conf.template > ./nginx/nginx.conf
- name: Build and push nginx image
uses: docker/build-push-action@v3
with:
context: ./nginx
file: ./nginx/Dockerfile
push: true
tags: |
${{ secrets.NCP_CONTAINER_REGISTRY }}/customk-nginx:${{ github.run_number }}
${{ secrets.NCP_CONTAINER_REGISTRY }}/customk-nginx:latest
cache-from: type=registry,ref=${{ secrets.NCP_CONTAINER_REGISTRY }}/customk-nginx:latest
cache-to: type=inline