Skip to content

feat(ci): add workflow, fix dockerfile #1

feat(ci): add workflow, fix dockerfile

feat(ci): add workflow, fix dockerfile #1

Workflow file for this run

name: Build and push image
on:
push:
branches:
- master
permissions:
contents: read
id-token: write
packages: write
jobs:
build:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.vars.outputs.image-tag }}
application: ${{ steps.vars.outputs.application }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set variables
id: vars
env:
EVENT_NAME: ${{ github.event_name }}
REF_TYPE: ${{ github.ref_type }}
REF_NAME: ${{ github.ref_name }}
GIT_SHA: ${{ github.sha }}
run: |
date="$(date -u +%Y%m%d)"
short_rev="$(git rev-parse --short "$GIT_SHA")"
echo "image-tag=${REF_NAME}" >> $GITHUB_OUTPUT
echo "application=bacchus-snu/snucse-api" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Configure registry credentials
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/bacchus-snu/${{ vars.IMAGE_NAME }}:${{ steps.vars.outputs.image-tag }}
cache-from: type=gha
cache-to: type=gha,mode=max