Skip to content

Commit 4c861f1

Browse files
Added a Dockerfile and spec for a VSCode dev container for CN. (#56)
1 parent 1d99b68 commit 4c861f1

File tree

3 files changed

+58
-4
lines changed

3 files changed

+58
-4
lines changed

.devcontainer/devcontainer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "CN Development",
3+
"image": "ghcr.io/rems-project/cn:release-devcontainer",
4+
// Uncomment to build the dev container locally.
5+
// "build": {
6+
// "dockerfile": "../Dockerfile.devcontainer"
7+
// },
8+
"features": {},
9+
"postCreateCommand": "",
10+
"customizations": {
11+
"vscode": {
12+
"extensions": [
13+
"ms-vscode.cpptools",
14+
"ms-vscode.cpptools-themes",
15+
"ms-vscode.cmake-tools",
16+
"ocamllabs.ocaml-platform",
17+
"ms-vscode.cpptools-extension-pack",
18+
"xaver.clang-format"
19+
]
20+
}
21+
}
22+
}

.github/workflows/docker.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
strategy:
2828
matrix:
29-
os: [ubuntu, redhat]
29+
os: [ubuntu, redhat, devcontainer]
3030
runner: [latest, 24.04-arm]
3131

3232
runs-on: ubuntu-${{ matrix.runner }}
@@ -62,7 +62,7 @@ jobs:
6262

6363
strategy:
6464
matrix:
65-
os: [ubuntu, redhat]
65+
os: [ubuntu, redhat, devcontainer]
6666
runs-on: ubuntu-latest
6767
needs: [build-and-release]
6868

@@ -91,7 +91,7 @@ jobs:
9191

9292
strategy:
9393
matrix:
94-
os: [ubuntu, redhat]
94+
os: [ubuntu, redhat, devcontainer]
9595
runs-on: ubuntu-latest
9696
needs: [combine-multiplatform]
9797

@@ -101,4 +101,4 @@ jobs:
101101
- name: Run CI tests
102102
run: |
103103
docker pull ${{env.CN_IMAGE_ID}}:release-${{ matrix.os }}
104-
docker run -v $PWD:/work -w /work ${{env.CN_IMAGE_ID}}:release-${{ matrix.os }} bash tests/run-cn.sh
104+
docker run -v $PWD:/work -w /work ${{env.CN_IMAGE_ID}}:release-${{ matrix.os }} bash tests/run-cn.sh

Dockerfile.devcontainer

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Build an image suitable for use as a VSCode dev container for CN development.
2+
FROM ubuntu:24.04
3+
4+
# Install system packages
5+
RUN apt-get update
6+
RUN apt-get upgrade -y
7+
RUN apt-get install -y opam libgmp-dev libmpfr-dev software-properties-common
8+
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
9+
RUN add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main"
10+
RUN add-apt-repository "deb-src http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main"
11+
RUN apt-get update
12+
RUN apt-get install -y clang-format-19
13+
RUN ln -s /usr/bin/clang-format-19 /usr/bin/clang-format
14+
15+
ENV OPAMCONFIRMLEVEL=unsafe-yes
16+
RUN opam init --disable-sandboxing
17+
18+
ADD . /opt/cerberus
19+
WORKDIR /opt/cerberus
20+
RUN opam install --deps-only ./cn.opam
21+
RUN opam install z3
22+
RUN opam install ocaml-lsp-server ocamlformat
23+
24+
RUN eval `opam env`
25+
26+
WORKDIR /opt
27+
28+
COPY docker_entry_point.sh /opt/docker_entry_point.sh
29+
RUN chmod +x /opt/docker_entry_point.sh
30+
RUN echo "source /opt/docker_entry_point.sh" >> /root/.bashrc
31+
WORKDIR /data
32+
ENTRYPOINT ["/opt/docker_entry_point.sh"]

0 commit comments

Comments
 (0)