Skip to content

Commit 1d4abc5

Browse files
update devcontainer Dockerfile
1 parent 9d02763 commit 1d4abc5

2 files changed

Lines changed: 22 additions & 81 deletions

File tree

docker_image/Dockerfile

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,15 @@
11
ARG BASE_IMAGE
22
FROM ${BASE_IMAGE}
33

4-
# We need to be root to install system dependencies
5-
USER root
6-
RUN apt-get update && apt-get install -y \
7-
gawk git pkg-config libgmp-dev libmpfr-dev libunwind-dev autoconf \
8-
&& rm -rf /var/lib/apt/lists/*
9-
10-
# We need to be root to install system dependencies,
11-
# but opam usually runs as a user. Assuming the base image
12-
# has a user 'opam', we switch to it.
13-
USER opam
14-
WORKDIR /home/opam/iris-tutorial
15-
16-
ARG OPAMYES=true
17-
ENV OPAMROOTISOK=true
18-
ARG MODE
19-
20-
# 3. Combined Opam Operation
21-
# This is the "Magic" fix: Adding repos, updating, and installing in ONE step
22-
# ensures the package solver doesn't use a stale cache.
234
RUN opam repo add rocq-released https://rocq-prover.org/opam/released --all --set-default && \
245
opam repo add iris-dev https://gitlab.mpi-sws.org/iris/opam.git --all --set-default && \
256
opam update
267

27-
# TODO: uncomment when vsrocq-language-server will start supporting ocaml 5.5
28-
# RUN opam install -y -w vsrocq-language-server.2.4.3
8+
COPY --from=repo iris-tutorial.opam .
9+
RUN opam install . --deps-only -y && \
10+
opam install -y rocq-iris-unstable
2911

30-
# 4. Copy the opam file
31-
COPY --chown=opam:opam iris-tutorial.opam .
32-
33-
# 5. Install Project Dependencies
34-
RUN opam install . --deps-only -y
35-
36-
# 4. If mode is unstable, install the extra unstable package
37-
RUN if [ "$MODE" = "unstable" ]; then \
38-
opam install -y rocq-iris-unstable; \
39-
fi
12+
# TODO: uncomment when vsrocq-language-server will start supporting ocaml 5.5
13+
# RUN opam install -y -w vsrocq-language-server
4014

4115
RUN echo "eval \$(opam env)" >> ~/.bashrc

docker_image/Makefile

Lines changed: 17 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,27 @@
11
REGISTRY := ghcr.io/logsem/iris-tutorial
2-
OCAML_VER := 5.5
3-
MODE ?= stable
4-
5-
# Logic for Base Image and Tags
6-
ifeq ($(MODE),unstable)
7-
BASE_IMAGE := ocaml/opam:debian-unstable-ocaml-5.5
8-
IMAGE_NAME := debian-unstable-ocaml-$(OCAML_VER)
9-
else
10-
BASE_IMAGE := ocaml/opam:debian-ocaml-5.5
11-
IMAGE_NAME := debian-ocaml-$(OCAML_VER)
12-
endif
2+
BASE_IMAGE := ocaml/opam:debian-12-ocaml-5.4
133

144
default:
15-
@echo 'Usage: make [stable-x86-64 | unstable-x86-64 | stable-arm64 | unstable-arm64]'
16-
17-
# Internal build logic
18-
build-%:
19-
$(eval ARCH_RAW := $*)
20-
$(eval PLATFORM := $(if $(filter x86-64,$(ARCH_RAW)),linux/amd64,linux/arm64))
21-
$(eval OPAM_ARCH := $(if $(filter x86-64,$(ARCH_RAW)),x86_64-linux,arm64-linux))
5+
@echo 'Usage: make [x86-64 | arm64 | push-x86-64 | push-arm64]'
226

23-
# We use -f to point to the Dockerfile because the context is now ".."
7+
x86-64:
248
docker build \
25-
--platform $(PLATFORM) \
9+
--platform linux/amd64 \
10+
--build-context repo=.. \
2611
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
27-
--build-arg MODE=$(MODE) \
28-
-f Dockerfile \
29-
-t $(REGISTRY)/$(IMAGE_NAME)-$(ARCH_RAW) \
30-
..
31-
32-
# Public targets
33-
stable-x86-64:
34-
$(MAKE) build-x86-64 MODE=stable
35-
36-
unstable-x86-64:
37-
$(MAKE) build-x86-64 MODE=unstable
38-
39-
stable-arm64:
40-
$(MAKE) build-arm64 MODE=stable
12+
-t $(REGISTRY)/docker-x86-64 .
4113

42-
unstable-arm64:
43-
$(MAKE) build-arm64 MODE=unstable
44-
45-
# Push targets
46-
push-stable-x86-64: stable-x86-64
47-
docker push $(REGISTRY)/debian-ocaml-$(OCAML_VER)-x86-64
48-
49-
push-unstable-x86-64: unstable-x86-64
50-
docker push $(REGISTRY)/debian-unstable-ocaml-$(OCAML_VER)-x86-64
14+
arm64:
15+
docker build \
16+
--platform linux/arm64 \
17+
--build-context repo=.. \
18+
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
19+
-t $(REGISTRY)/docker-arm64 .
5120

52-
push-stable-arm64: stable-arm64
53-
docker push $(REGISTRY)/debian-ocaml-$(OCAML_VER)-arm64
21+
push-x86-64: x86-64
22+
docker push $(REGISTRY)/docker-x86-64
5423

55-
push-unstable-arm64: unstable-arm64
56-
docker push $(REGISTRY)/debian-unstable-ocaml-$(OCAML_VER)-arm64
24+
push-arm64: arm64
25+
docker push $(REGISTRY)/docker-arm64
5726

58-
.PHONY: stable-x86-64 unstable-x86-64 stable-arm64 unstable-arm64 \
59-
push-stable-x86-64 push-unstable-x86-64 push-stable-arm64 push-unstable-arm64 \
60-
default
27+
.PHONY: x86-64 arm64 push-x86-64 push-arm64 default

0 commit comments

Comments
 (0)