diff --git a/.github/workflows/oscms-ci-docker.yml b/.github/workflows/oscms-ci-docker.yml new file mode 100644 index 0000000..2bbe254 --- /dev/null +++ b/.github/workflows/oscms-ci-docker.yml @@ -0,0 +1,84 @@ +# Copyright (c) 2026 LG Electronics, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http:#www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +name: OpenSCMS/oscms-ci-docker +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +env: + CI_REGISTRY: ghcr.io + CI_REGISTRY_IMAGE: ghcr.io/openscms/oscms-ci-docker + +concurrency: + group: "${{ github.ref }}" + cancel-in-progress: true + +jobs: + build-docker-ci-image: + runs-on: + - ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + timeout-minutes: 60 + + steps: + - name: Checkout repository + uses: actions/checkout@v4.1.0 + with: + fetch-depth: 0 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3.0.0 + with: + registry: ${{ env.CI_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Get image metadata + id: meta + uses: docker/metadata-action@v5.0.0 + with: + images: ${{ env.CI_REGISTRY_IMAGE }} + tags: | + type=raw,value=latest,enable={{ is_default_branch }} + type=ref,event=tag + type=ref,event=pr + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v5.0.0 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=${{ env.CI_REGISTRY_IMAGE }}:latest + file: openscms-ci.dockerfile + + - name: Image digest + run: echo ${{ steps.push.outputs.digest }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5215291 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.env.local +log/ diff --git a/README.md b/README.md index b3c7647..7d8b17b 100644 --- a/README.md +++ b/README.md @@ -50,13 +50,18 @@ This will place you in a `bash` shell within the container, with your cloned sou ## Pulling the image from GitHub +The image is published on `ghcr.io` as a public image. Simply pull it as follows + ```bash -docker login ghcr.io -u YOUR_GITHUB_USERNAME -# When prompted for a password, paste your Personal Access Token (PAT) -docker pull ghcr.io/OpenSCMS/oscms-ci-docker/oscms-ci-docker:latest +docker pull ghcr.io/openscms/oscms-ci-docker:latest ``` -You can then run it as shown above. +You can then run it as shown below. + +```bash +docker run -ti --rm --volume $PWD:/WORK --user $(id -u):$(id -g) \ + ghcr.io/openscms/oscms-ci-docker:latest +``` ## Contributing