Skip to content

Commit 2ff165f

Browse files
committed
Add BASE_IMG dependency
1 parent d574647 commit 2ff165f

File tree

4 files changed

+63
-5
lines changed

4 files changed

+63
-5
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,17 @@ jobs:
4848
matrix:
4949
# based off of the branches in the idris-lsp repo
5050
idris-lsp-version: ["idris2-0.5.1", "idris2-0.6.0", "latest"]
51+
include:
52+
- idris-lsp-version: "idris2-0.5.1"
53+
idris-version: "v0.5.1"
54+
- idris-lsp-version: "idris2-0.6.0"
55+
idris-version: "v0.6.0"
56+
- idris-lsp-version: "latest"
57+
idris-version: "latest"
5158
uses: ./.github/workflows/version-devcontainer-build-test.yml
5259
with:
5360
idris-lsp-version: ${{ matrix.idris-lsp-version }}
61+
idris-version: ${{ matrix.idris-version }}
5462
secrets: inherit
5563

5664
devcontainer-deploy:
@@ -61,8 +69,16 @@ jobs:
6169
strategy:
6270
matrix:
6371
idris-lsp-version: ["idris2-0.5.1", "idris2-0.6.0", "latest"]
72+
include:
73+
- idris-lsp-version: "idris2-0.5.1"
74+
idris-version: "v0.5.1"
75+
- idris-lsp-version: "idris2-0.6.0"
76+
idris-version: "v0.6.0"
77+
- idris-lsp-version: "latest"
78+
idris-version: "latest"
6479
max-parallel: 1
6580
uses: ./.github/workflows/version-devcontainer-deploy.yml
6681
with:
6782
idris-lsp-version: ${{ matrix.idris-lsp-version }}
83+
idris-version: ${{ matrix.idris-version }}
6884
secrets: inherit

.github/workflows/version-devcontainer-build-test.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,57 @@ on:
66
idris-lsp-version:
77
required: true
88
type: string
9+
idris-version:
10+
required: true
11+
type: string
912

1013
# Don't allow us to read from packages
1114
permissions:
1215
contents: read
1316

1417
jobs:
1518
devcontainer-build-test:
16-
name: Build Devcontainer
19+
name: Build Devcontainer - ${{ inputs.idris-lsp-version }}
1720
runs-on: ubuntu-latest
21+
services:
22+
registry:
23+
image: registry:2
24+
ports:
25+
- 5000:5000
1826
env:
27+
BASE_TAG: localhost:5000/base-${{ inputs.idris-version }}:latest
1928
TAG: idris-devcontainer-${{ inputs.idris-lsp-version }}:test
2029
steps:
2130
- name: Checkout Repo
2231
uses: actions/checkout@v3
2332

2433
- name: Setup Buildx (no ARM)
2534
uses: docker/setup-buildx-action@v2
35+
with:
36+
# since we're using a local registry
37+
driver-opts: network=host
2638

2739
- name: Get Latest Idris Commit SHA
2840
id: get-sha
2941
uses: ./.github/actions/get-idris-sha
42+
43+
# Building base because devcontainer image depends on it for idris binary
44+
# only using cache-from because this should already be cached (we won't be writing to cache)
45+
- name: Build Base
46+
uses: docker/[email protected]
47+
with:
48+
context: .
49+
file: base.Dockerfile
50+
build-args: |
51+
IDRIS_VERSION=${{ inputs.idris-version }}
52+
IDRIS_SHA=${{ steps.get-sha.outputs.sha }}
53+
tags: ${{ env.BASE_TAG }}
54+
# push to local registry
55+
push: true
56+
cache-from: type=gha,scope=build-base-${{ inputs.idris-version }}
57+
58+
- name: Run `docker image ls`
59+
run: docker image ls
3060

3161
- name: Build Devcontainer
3262
uses: docker/[email protected]
@@ -36,9 +66,13 @@ jobs:
3666
build-args: |
3767
IDRIS_LSP_VERSION=${{ inputs.idris-lsp-version }}
3868
IDRIS_LSP_SHA=${{ steps.get-sha.outputs.lsp-sha }}
69+
IDRIS_VERSION=${{ inputs.idris-version }}
70+
IDRIS_SHA=${{ steps.get-sha.outputs.idris-sha }}
71+
BASE_IMG=${{ env.BASE_TAG }}
3972
load: true
4073
tags: ${{ env.TAG }}
4174
cache-from: type=gha,scope=build-devcontainer-${{ inputs.idris-lsp-version }}
75+
cache-to: type=gha,mode=max,scope=build-devcontainer-${{ inputs.idris-lsp-version }}
4276

4377
- name: Setup Bats and Bats libs
4478
uses: brokenpip3/[email protected]
@@ -55,4 +89,4 @@ jobs:
5589
run: |
5690
export LIB_PATH=/usr/lib/
5791
export DOCKER_IMAGE=${{ env.TAG }}
58-
bats tests/devcontainer-idris.bats
92+
bats tests/devcontainer-idris.bats

.github/workflows/version-devcontainer-deploy.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
idris-lsp-version:
77
required: true
88
type: string
9+
idris-version:
10+
required: true
11+
type: string
912

1013
permissions:
1114
packages: write
@@ -55,10 +58,14 @@ jobs:
5558
context: .
5659
platforms: linux/amd64,linux/arm64
5760
file: devcontainer.Dockerfile
61+
# we run this after base so we can pull the base_img from the registry
5862
build-args: |
5963
IDRIS_LSP_VERSION=${{ inputs.idris-lsp-version }}
6064
IDRIS_LSP_SHA=${{ steps.get-sha.outputs.lsp-sha }}
61-
tags: ghcr.io/${{ github.repository }}/base:${{ inputs.idris-lsp-version }}
62-
labels: ${{ steps.create-meta.outputs.labels }}
65+
IDRIS_VERSION=${{ inputs.idris-version }}
66+
IDRIS_SHA=${{ steps.get-sha.outputs.idris-sha }}
67+
BASE_IMG=ghcr.io/joshuanianji/idris-2-docker/base:${{ inputs.idris-version }}
68+
tags: ghcr.io/${{ github.repository }}/base:${{ inputs.idris-lsp-version }}
69+
labels: ${{ steps.create-meta.outputs.labels }}
6370
push: true
6471
cache-from: type=gha,scope=build-devcontainer-${{ inputs.idris-lsp-version }}

devcontainer.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
ARG IDRIS_VERSION=latest
2+
ARG BASE_IMG=ghcr.io/joshuanianji/idris-2-docker/base:${IDRIS_VERSION}
23

34
# =====
45
# Idris Builder
56
# Rebuild with correct prefix. Somehow, building from scratch with a different prefix fails
6-
FROM ghcr.io/joshuanianji/idris-2-docker/base:${IDRIS_VERSION} as idris-builder
7+
FROM $BASE_IMG as idris-builder
78
ARG IDRIS_VERSION
89
ARG IDRIS_SHA
910

0 commit comments

Comments
 (0)