Skip to content

Build Docker Image

Build Docker Image #48

Workflow file for this run

name: Build Docker Image
on:
push:
branches:
- 'main'
schedule:
- cron: '0 10 * * 1'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set Image Tag
id: set_image_tag
run: |
WEEK_NUMBER=$(date +%U)
YEAR=$(date +%Y)
echo "IMAGE_VERSION=$YEAR-$WEEK_NUMBER" >> $GITHUB_ENV
- name: Build Docker Image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: |
charlessortlist/wordpress-image:${{ env.IMAGE_VERSION }}
charlessortlist/wordpress-image:latest