fix username #6
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 Build CI | |
on: | |
push: | |
tags: | |
- 'tag/build-docker-image/*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Read version from .env | |
id: env | |
run: echo "::set-output name=PRODUCTION_BUILD_VERSION::$(grep ^PRODUCTION_BUILD_VERSION= .env | cut -d'=' -f2)" | |
- name: Build the Docker image for latest | |
run: docker build -f ./.docker/Dockerfile_production -t ${{ vars.DOCKERHUB_USERNAME}}/tweb:latest . | |
- name: Build the Docker image for specific version | |
run: | | |
version=${{ steps.env.outputs.PRODUCTION_BUILD_VERSION }} | |
docker build -f ./.docker/Dockerfile_production -t ${{ vars.DOCKERHUB_USERNAME}}/tweb:${version} . | |
- name: Login to Docker Hub | |
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ vars.DOCKERHUB_USERNAME}}" --password-stdin | |
- name: Push versioned image | |
run: | | |
version=${{ steps.env.outputs.VERSION }} | |
docker push ${{ vars.DOCKERHUB_USERNAME}}/tweb:${version} | |
- name: Push latest image | |
run: | | |
docker push ${{ vars.DOCKERHUB_USERNAME}}/tweb:latest |