Skip to content

feat(environment): Dockerized application #9

feat(environment): Dockerized application

feat(environment): Dockerized application #9

Workflow file for this run

name: "Continuous Deployment"
on:
push:
branches: ["main", "dev"]
jobs:
push_to_registry:
name: Push Docker Image to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Create Short SHA
uses: benjlevesque/[email protected]
id: short-sha
with:
length: 8
- name: Set image name
id: set-image-name
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
echo "BINARY_NAME=rpl-service" >> $GITHUB_ENV
else
echo "BINARY_NAME=rpl-service-dev" >> $GITHUB_ENV
fi
shell: /usr/bin/bash -e {0}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to GitHub Packages
id: docker_build
uses: docker/build-push-action@v4
with:
secrets: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
GITHUB_USER=${{ github.actor }}
context: .
push: true
tags: |
ghcr.io/willytonkas/${{env.BINARY_NAME}}:latest