Docker Image CI #7
Workflow file for this run
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 | |
paths: | |
- Dockerfile | |
workflow_dispatch: | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
#For architecture emulation | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
#For multi-architecture image building | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Build the specific stage of the multi-stage Dockerfile | |
- uses: actions/checkout@v3 | |
- name: Set Docker repository name | |
id: set_docker_repo_name | |
run: echo "::set-output name=docker_repo_name::$(echo ${GITHUB_REPOSITORY#*/} | tr '[:upper:]' '[:lower:]')" | |
- name: Build Docker image | |
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ steps.set_docker_repo_name.outputs.docker_repo_name }}:latest -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ steps.set_docker_repo_name.outputs.docker_repo_name }}:$(date +"%Y%m%d%H%M%S") .devcontainer/ros2/. | |
- name: Push Docker image | |
run: | | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ steps.set_docker_repo_name.outputs.docker_repo_name }}:latest | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ steps.set_docker_repo_name.outputs.docker_repo_name }}:$(date +"%Y%m%d%H%M%S") |