Skip to content

Dont use root

Dont use root #278

Workflow file for this run

name: Docker Image CI
on:
pull_request:
branches: ["main"]
paths:
- "Dockerfile"
env:
# Use docker.io for Docker Hub if empty
REGISTRY: docker.io
# github.repository as <account>/<repo>
IMAGE_NAME: rgpeach10/shell
concurrency:
group: cd-${{ github.ref_name }}
# If this is enabled it will cancel current running and start latest
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set SAFE_BRANCH_NAME
run: echo "SAFE_BRANCH_NAME=${BRANCH_NAME//\//__}" >> $GITHUB_ENV
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Context for Buildx
shell: bash
id: buildx-context
run: |
docker context create buildx-context || true
- name: Use Docker Context for Buildx
shell: bash
id: use-buildx-context
run: |
docker context use buildx-context || true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: --debug
endpoint: buildx-context
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: rgpeach10
password: ${{ secrets.DOCKERHUB_PAT }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
push: false
tags: latest
cache-from: |
type=registry,ref=rgpeach10/shell:${{env.SAFE_BRANCH_NAME}}
type=registry,ref=rgpeach10/shell:buildcache-arm64
cache-to: type=registry,ref=rgpeach10/shell:${{env.SAFE_BRANCH_NAME}},mode=max
platforms: linux/arm64