FEAT: remove build info environment variables #2
This file contains hidden or 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" ] | |
| schedule: | |
| - cron: '0 4 * * 1' | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Set image name and tags | |
| id: vars | |
| run: | | |
| IMAGE_NAME=sukibijo9852/localstack | |
| GIT_SHA=${{ github.sha }} | |
| UNIX_TS=$(date +%s) | |
| if [[ "${{ github.event_name }}" == "schedule" ]]; then | |
| TAG="auto-${UNIX_TS}" | |
| else | |
| TAG="${GIT_SHA}" | |
| fi | |
| echo "image_name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT" | |
| echo "tag=${TAG}" >> "$GITHUB_OUTPUT" | |
| - name: Build Docker image | |
| run: | | |
| docker build . \ | |
| --file Dockerfile \ | |
| --tag ${{ steps.vars.outputs.image_name }}:${{ steps.vars.outputs.tag }} \ | |
| --tag ${{ steps.vars.outputs.image_name }}:latest | |
| - name: Push Docker image to Docker Hub | |
| run: | | |
| docker push ${{ steps.vars.outputs.image_name }}:${{ steps.vars.outputs.tag }} | |
| docker push ${{ steps.vars.outputs.image_name }}:latest |