dockerfile #2
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: Moogly build and push | |
env: | |
REGISTRY: docker.io | |
IMAGE_NAME: ${{ secrets.DOCKER_USERNAME }}/moogly | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout repository | |
uses: actions/checkout@v3 | |
- | |
name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- id: string | |
uses: ASzc/change-string-case-action@v2 | |
with: | |
string: ${{ env.IMAGE_NAME }} | |
- | |
name: Generate random tag | |
id: random_tag | |
run: echo "tag=$(openssl rand -hex 6)" >> $GITHUB_ENV | |
- | |
name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ steps.string.outputs.lowercase }}:${{ env.tag }}, ${{ env.REGISTRY }}/${{ steps.string.outputs.lowercase }}:latest |