Spaces:
Running
Running
name: Docker Image CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: List files in the repository root | |
run: ls -alh | |
- name: Build and push Docker image | |
run: | | |
docker buildx build --file ./Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/picpilot:$(date +%s) --push --cache-to=type=local,dest=/tmp/.buildx-cache,new=true --cache-from=type=local,src=/tmp/.buildx-cache . | |
working-directory: ${{ github.workspace }} | |