Skip to content

Commit bf24b59

Browse files
committed
Add build-image script example in README
1 parent 1778cdb commit bf24b59

File tree

1 file changed

+16
-31
lines changed

1 file changed

+16
-31
lines changed

README.md

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Idris Versions: `v0.5.1`, `v0.6.0`, `latest` (Up to date with [Idris2/main](http
2020
- [Command Line](#command-line)
2121
- [Base Image](#base-image)
2222
- [Running Locally](#running-locally)
23-
- [Build Latest (or a Specific Commit)](#build-latest-or-a-specific-commit)
24-
- [Build From a Tagged Release](#build-from-a-tagged-release)
23+
- [Build Latest](#build-latest)
24+
- [Build From a Tagged Release/SHA commit](#build-from-a-tagged-releasesha-commit)
2525
- [Credit](#credit)
2626

2727
## Motivation
@@ -30,7 +30,8 @@ Installing Idris2 is [quite time consuming](https://idris2.readthedocs.io/en/lat
3030

3131
## Images
3232

33-
* [idris-2-docker/devcontainer](https://github.com/joshuanianji/idris-2-docker/pkgs/container/idris-2-docker%2Fdevcontainer) - Debian bullseye built off of [Microsoft's Devcontainer Base image](https://github.com/microsoft/vscode-dev-containers/tree/main/containers/debian)
33+
* [idris-2-docker/base](https://github.com/joshuanianji/idris-2-docker/pkgs/container/idris-2-docker%2Fbase) - Base image with Idris2 installed from source.
34+
* [idris-2-docker/devcontainer](https://github.com/joshuanianji/idris-2-docker/pkgs/container/idris-2-docker%2Fdevcontainer) - Includes [Idris2 LSP](https://github.com/idris-community/idris2-lsp)
3435
* [idris-2-docker/ubuntu](https://github.com/joshuanianji/idris-2-docker/pkgs/container/idris-2-docker%2Fubuntu) - Ubuntu 20.04
3536
* [idris-2-docker/debian](https://github.com/joshuanianji/idris-2-docker/pkgs/container/idris-2-docker%2Fdebian) - Debian bullseye
3637

@@ -65,7 +66,7 @@ Click "Reopen in Container" and it will download the image and open the project
6566
Add devcontainers to your own project by copying the following contents to `Dockerfile` in the root of your project:
6667

6768
```dockerfile
68-
FROM ghcr.io/joshuanianji/idris-2-docker/devcontainer:v0.5.1
69+
FROM ghcr.io/joshuanianji/idris-2-docker/devcontainer:v0.7.0
6970
```
7071

7172
Then, using Microsoft's Remote SSH tools, click "Reopen in container" and choose that Dockerfile.
@@ -94,40 +95,24 @@ FROM ghcr.io/joshuanianji/idris-2-docker/debian:v0.5.1
9495

9596
## Running Locally
9697

97-
To run the images locally, I recommend opening the workspace in the Devcontainer to provide a fully-featured development environment.
98+
To run the images locally, I recommend opening the workspace in the Devcontainer to provide a fully-featured development environment. I made a `scripts/build-image.py` which can build the base, debian, ubuntu or devcontainer from an idris version or a SHA commit.
9899

99-
### Build Latest (or a Specific Commit)
100+
### Build Latest
101+
102+
This is the default behaviour when running the script.
100103

101104
```bash
102-
export IDRIS_VERSION=latest
103-
# get latest commit - here we're using the github api and jq
104-
export IDRIS_SHA=$(curl -s 'https://api.github.com/repos/idris-lang/Idris2/commits' | jq -r '.[0].sha')
105-
106-
# tagging the base image so other Dockerfiles can reference it
107-
docker build \
108-
--build-arg IDRIS_SHA=$IDRIS_SHA \
109-
--build-arg IDRIS_VERSION=$IDRIS_VERSION \
110-
-f base.Dockerfile \
111-
-t "ghcr.io/joshuanianji/idris-2-docker/base:${IDRIS_VERSION}" .
112-
113-
# Build other images
114-
# the devcontainer image needs $IDRIS_SHA but debian and ubuntu do not
115-
docker build \
116-
--build-arg IDRIS_SHA=$IDRIS_SHA \
117-
--build-arg IDRIS_VERSION=$IDRIS_VERSION \
118-
-f devcontainer.Dockerfile .
105+
# builds base from latest commit on the Idris repo. Tag is base-latest
106+
python scripts/build-image.py --image base
107+
python scripts/build-image.py --image devcontainer --tag devcontainer-latest-test
119108
```
120109

121-
### Build From a Tagged Release
110+
### Build From a Tagged Release/SHA commit
122111

123112
```bash
124-
export IDRIS_VERSION=v0.6.0
125-
126-
# tagging the base image so other Dockerfiles can reference it
127-
docker build -f base.Dockerfile -t "ghcr.io/joshuanianji/idris-2-docker/base:${IDRIS_VERSION}" .
128-
129-
# Build other images
130-
docker build -f devcontainer.Dockerfile .
113+
python scripts/build-image.py --image base --version v0.6.0
114+
python scripts/build-image.py --image base --sha 58e5d156621cfdd4c54df26abf7ac9620cfebdd8
115+
python scripts/build-image.py --image devcontainer --version v0.6.0
131116
```
132117

133118
## Credit

0 commit comments

Comments
 (0)