Skip to content

try docker hub

try docker hub #30

Workflow file for this run

name: Build and Push Docker Image
on: [push]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Fetch Vault Secret
id: fetch-vault-secret
uses: hashicorp/vault-action@v2
with:
url: http://localhost:8200
token: ${{ secrets.VAULT_TOKEN }}
secrets: |
/v1/keyvalue/data/docker/hub pass | DOCKER_HUB_ACCESS_TOKEN ;
/v1/keyvalue/data/docker/hub user | DOCKER_HUB_USERNAME ;
- name: Set environment variables
run: |
echo "DOCKER_HUB_USERNAME=${{ steps.fetch-vault-secret.outputs.secrets.DOCKER_HUB_USERNAME }}" >> $GITHUB_ENV
echo "DOCKER_HUB_ACCESS_TOKEN=${{ steps.fetch-vault-secret.outputs.secrets.DOCKER_HUB_ACCESS_TOKEN }}" >> $GITHUB_ENV
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile