feat: nginx config for pos #981
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main, develop ] | |
pull_request: | |
branches: [ main, develop ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
dockerize: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app: [ dashboard, point-of-sale, point-of-sale-ab] | |
include: | |
- app: dashboard | |
env_file_main: ${{ vars.ENV_FILE_PRODUCTION }} | |
env_file_develop: ${{ vars.ENV_FILE_DEVELOPMENT }} | |
docker_tag: ${{ vars.DOCKER_TAG_DASHBOARD }} | |
dockerfile_path: "apps/dashboard/Dockerfile" | |
dir: "dashboard" | |
- app: point-of-sale | |
env_file_main: ${{ vars.ENV_FILE_PRODUCTION }} | |
env_file_develop: ${{ vars.ENV_FILE_DEVELOPMENT }} | |
docker_tag: ${{ vars.DOCKER_TAG_POS }} | |
dockerfile_path: "apps/point-of-sale/Dockerfile" | |
dir: "point-of-sale" | |
- app: point-of-sale-ab | |
env_file_main: ${{ vars.ENV_FILE_PRODUCTION }} | |
env_file_develop: ${{ vars.ENV_FILE_PRODUCTION }} | |
docker_tag: ${{ vars.DOCKER_TAG_POS }}-ab | |
dockerfile_path: "apps/point-of-sale/Dockerfile" | |
dir: "point-of-sale" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
path: . | |
- name: Safe directory | |
run: git config --global --add safe.directory '*' | |
- name: Get short commit SHA | |
run: echo "GIT_COMMIT_SHA=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV | |
- name: Set up environment - main | |
env: | |
ENV_FILE: ${{ matrix.env_file_main }} | |
if: github.ref == 'refs/heads/main' | |
run: | | |
echo "${ENV_FILE}" > ./apps/${{ matrix.dir }}/.env | |
- name: Set up environment - develop | |
env: | |
ENV_FILE: ${{ matrix.env_file_develop }} | |
if: github.ref != 'refs/heads/main' | |
run: | | |
echo "${ENV_FILE}" > apps/${{ matrix.dir }}/.env | |
- name: Get Docker meta (for tags) | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
${{ vars.DOCKER_REGISTRY }}/${{ matrix.docker_tag }} | |
tags: | | |
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to SudoSOS Container Registry | |
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ vars.DOCKER_REGISTRY }} | |
username: ${{ secrets.SVC_GH_SUDOSOS_USERNAME }} | |
password: ${{ secrets.SVC_GH_SUDOSOS_PWD }} | |
# Build and push Docker image with Buildx | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64 #SudoSOS does not run on linux/arm64 | |
push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
GIT_COMMIT_BRANCH=${{ github.head_ref || github.ref_name }} | |
GIT_COMMIT_SHA=${{ env.GIT_COMMIT_SHA }} | |
file: ${{ matrix.dockerfile_path }} |