Skip to content

Commit 32ec8dc

Browse files
committed
add actions
1 parent ded8283 commit 32ec8dc

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
name: Build Docker image
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches: [ main ]
8+
tags:
9+
- 'v*'
10+
pull_request:
11+
branches: [ main ]
12+
13+
jobs:
14+
build-docker-image:
15+
if: github.repository_owner == 'LCAS'
16+
runs-on:
17+
- lcas
18+
- qemu
19+
steps:
20+
- name: Node Js
21+
uses: actions/setup-node@v4
22+
23+
- uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 1
26+
submodules: 'recursive'
27+
28+
- name: What
29+
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
30+
31+
- name: Docker Login LCAS
32+
uses: docker/login-action@v3
33+
with:
34+
registry: lcas.lincoln.ac.uk
35+
username: ${{ secrets.LCAS_REGISTRY_PUSHER }}
36+
password: ${{ secrets.LCAS_REGISTRY_TOKEN }}
37+
38+
- name: "image name from repo name"
39+
id: docker_image_name
40+
run: echo "docker_image=${{ github.repository }}" | tr '[:upper:]' '[:lower:]' |sed 's/[^0-9,a-z,A-Z,=,_,\/]/-/g' >>${GITHUB_OUTPUT}
41+
42+
- name: Docker meta
43+
id: meta_public
44+
uses: docker/metadata-action@v5
45+
with:
46+
# list of Docker images to use as base name for tags
47+
images: lcas.lincoln.ac.uk/${{ steps.docker_image_name.outputs.docker_image }}
48+
# generate Docker tags based on the following events/attributes
49+
tags: |
50+
type=raw,value=staging
51+
type=raw,value=latest,enable={{is_default_branch}}
52+
type=ref,enable=${{ github.event_name != 'pull_request' }},event=branch
53+
type=semver,pattern={{version}}
54+
type=semver,pattern={{major}}.{{minor}}
55+
type=semver,pattern={{major}}
56+
57+
- name: Build Public Docker Image
58+
uses: docker/build-push-action@v6
59+
with:
60+
context: .
61+
file: .devcontainer/Dockerfile
62+
platforms: linux/amd64,linux/arm64
63+
push: true
64+
cache-from: type=registry,ref=lcas.lincoln.ac.uk/cache/${{ steps.docker_image_name.outputs.docker_image }}:latest
65+
cache-to: type=registry,ref=lcas.lincoln.ac.uk/cache/${{ steps.docker_image_name.outputs.docker_image }}:latest,mode=max
66+
tags: ${{ steps.meta_public.outputs.tags }}
67+
labels: ${{ steps.meta_public.outputs.labels }}
68+
build-args: |
69+
BASE_IMAGE=lcas.lincoln.ac.uk/lcas/limo_platform:2.2
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: 'devcontainer CI'
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: lcas
14+
steps:
15+
- name: Node Js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: "^16.13.0 || >=18.0.0"
19+
- name: Checkout (GitHub)
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 1
23+
submodules: 'recursive'
24+
- name: What
25+
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
26+
- name: "image name from repo name"
27+
id: docker_image_name
28+
run: echo "docker_image=${{ github.repository }}" | tr '[:upper:]' '[:lower:]' |sed 's/[^0-9,a-z,A-Z,=,_,\/]/-/g' >>${GITHUB_OUTPUT}
29+
- name: Build container
30+
uses: devcontainers/ci@v0.3
31+
with:
32+
imageName: lcas.lincoln.ac.uk/devcontainer/${{ steps.docker_image_name.outputs.docker_image }}
33+
push: never
34+
imageTag: ci
35+
#runCmd: "bash .devcontainer/run-ci.sh"

0 commit comments

Comments
 (0)