diff --git a/.github/workflows/container-build.yml b/.github/workflows/container-build.yml new file mode 100644 index 0000000..db88fc7 --- /dev/null +++ b/.github/workflows/container-build.yml @@ -0,0 +1,69 @@ + +name: Build Docker image + +on: + workflow_dispatch: + push: + branches: [ main ] + tags: + - 'v*' + pull_request: + branches: [ main ] + +jobs: + build-docker-image: + if: github.repository_owner == 'LCAS' + runs-on: + - lcas + - qemu + steps: + - name: Node Js + uses: actions/setup-node@v4 + + - uses: actions/checkout@v3 + with: + fetch-depth: 1 + submodules: 'recursive' + + - name: What + run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + + - name: Docker Login LCAS + uses: docker/login-action@v3 + with: + registry: lcas.lincoln.ac.uk + username: ${{ secrets.LCAS_REGISTRY_PUSHER }} + password: ${{ secrets.LCAS_REGISTRY_TOKEN }} + + - name: "image name from repo name" + id: docker_image_name + run: echo "docker_image=${{ github.repository }}" | tr '[:upper:]' '[:lower:]' |sed 's/[^0-9,a-z,A-Z,=,_,\/]/-/g' >>${GITHUB_OUTPUT} + + - name: Docker meta + id: meta_public + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + images: lcas.lincoln.ac.uk/${{ steps.docker_image_name.outputs.docker_image }} + # generate Docker tags based on the following events/attributes + tags: | + type=raw,value=staging + type=raw,value=latest,enable={{is_default_branch}} + type=ref,enable=${{ github.event_name != 'pull_request' }},event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + + - name: Build Public Docker Image + uses: docker/build-push-action@v6 + with: + context: . + file: .devcontainer/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + cache-from: type=registry,ref=lcas.lincoln.ac.uk/cache/${{ steps.docker_image_name.outputs.docker_image }}:latest + cache-to: type=registry,ref=lcas.lincoln.ac.uk/cache/${{ steps.docker_image_name.outputs.docker_image }}:latest,mode=max + tags: ${{ steps.meta_public.outputs.tags }} + labels: ${{ steps.meta_public.outputs.labels }} + build-args: | + BASE_IMAGE=lcas.lincoln.ac.uk/lcas/limo_platform:2.2 \ No newline at end of file diff --git a/.github/workflows/dev-container.yml b/.github/workflows/dev-container.yml new file mode 100644 index 0000000..ea13cb0 --- /dev/null +++ b/.github/workflows/dev-container.yml @@ -0,0 +1,35 @@ +name: 'devcontainer CI' +on: + workflow_dispatch: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + build: + runs-on: lcas + steps: + - name: Node Js + uses: actions/setup-node@v4 + with: + node-version: "^16.13.0 || >=18.0.0" + - name: Checkout (GitHub) + uses: actions/checkout@v4 + with: + fetch-depth: 1 + submodules: 'recursive' + - name: What + run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + - name: "image name from repo name" + id: docker_image_name + run: echo "docker_image=${{ github.repository }}" | tr '[:upper:]' '[:lower:]' |sed 's/[^0-9,a-z,A-Z,=,_,\/]/-/g' >>${GITHUB_OUTPUT} + - name: Build container + uses: devcontainers/ci@v0.3 + with: + imageName: lcas.lincoln.ac.uk/devcontainer/${{ steps.docker_image_name.outputs.docker_image }} + push: never + imageTag: ci + #runCmd: "bash .devcontainer/run-ci.sh" \ No newline at end of file