Update docker-image.yml #6
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: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
run: echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USER_NAME }}" --password-stdin | |
- name: Build the Docker image | |
run: docker build . --file Mostlylucid/Dockerfile --tag ${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:latest | |
- name: Tag the Docker image with a timestamp | |
run: docker tag ${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:latest ${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:$(date +%s) | |
- name: Push the Docker image to Docker Hub | |
run: | | |
docker push ${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:latest | |
docker push ${{ secrets.DOCKER_HUB_USER_NAME }}/mostlylucid:$(date +%s) | |