Skip to content

Update docker-image.yml #6

Update docker-image.yml

Update docker-image.yml #6

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
- name: Build the Docker image
run: |
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/somochkin-blog
TIMESTAMP=$(date +%s)
docker build . --file Dockerfile --tag $IMAGE_NAME:$TIMESTAMP
docker tag $IMAGE_NAME:$TIMESTAMP $IMAGE_NAME:latest
echo $IMAGE_NAME:$TIMESTAMP > image_name.txt
- name: Debug output
run: cat image_name.txt
- name: Push the Docker image
run: |
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/somochkin-blog
TIMESTAMP=$(cat image_name.txt)
echo "Pushing image $IMAGE_NAME:$TIMESTAMP"
echo "Pushing image $IMAGE_NAME:latest"
docker push $IMAGE_NAME:$TIMESTAMP
docker push $IMAGE_NAME:latest