Skip to content

Commit 579a5ee

Browse files
committed
Add Ubuntu image files
1 parent ee8dcf3 commit 579a5ee

File tree

8 files changed

+77
-73
lines changed

8 files changed

+77
-73
lines changed

DockerOcamlbuild

Lines changed: 0 additions & 59 deletions
This file was deleted.

DockerfileUbuntu

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
FROM ubuntu:22.04 AS Builder
2+
3+
ENV OPAMROOT=/opt/ocaml
4+
5+
RUN set -ex; \
6+
mkdir -p $OPAMROOT; \
7+
useradd --create-home codewarrior; \
8+
chown codewarrior:codewarrior $OPAMROOT; \
9+
apt-get update; \
10+
apt-get install -y --no-install-recommends \
11+
software-properties-common \
12+
libgmp-dev \
13+
opam \
14+
;
15+
16+
USER codewarrior
17+
ENV USER=codewarrior
18+
19+
RUN set -ex; \
20+
opam init -y --disable-sandboxing --compiler=5.0.0;
21+
22+
RUN set -ex; \
23+
opam install -y \
24+
'batteries=3.6.0' \
25+
'base=v0.15.1' \
26+
'domainslib=0.5.0' \
27+
'ocamlbuild=0.14.2' \
28+
'ocamlfind=1.9.6' \
29+
'ounit2=2.2.7' \
30+
'zarith=1.12' \
31+
;
32+
33+
FROM ubuntu:22.04
34+
35+
RUN set -ex; \
36+
apt-get update; \
37+
apt-get install -y --no-install-recommends \
38+
gcc \
39+
libc6-dev \
40+
libgmp-dev \
41+
; \
42+
rm -rf /var/lib/apt/lists/*;
43+
44+
COPY --from=builder \
45+
/opt/ocaml/5.0.0/bin/ocamlc.opt \
46+
/opt/ocaml/5.0.0/bin/ocamlopt.opt \
47+
/opt/ocaml/5.0.0/bin/ocamldep.opt \
48+
/opt/ocaml/5.0.0/bin/ocamlbuild \
49+
/opt/ocaml/5.0.0/bin/ocamlfind \
50+
/opt/ocaml/5.0.0/bin/
51+
COPY --from=builder \
52+
/opt/ocaml/5.0.0/lib/ /opt/ocaml/5.0.0/lib/
53+
54+
RUN set -ex; \
55+
useradd --create-home codewarrior; \
56+
mkdir -p /workspace; \
57+
chown -R codewarrior:codewarrior /workspace;
58+
59+
USER codewarrior
60+
ENV USER=codewarrior \
61+
PATH=/opt/ocaml/5.0.0/bin:$PATH
62+
63+
COPY --chown=codewarrior:codewarrior workspace/. /workspace/
64+
WORKDIR /workspace

bin/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
docker build -t ocaml:latest .
1+
docker build -t ocaml:alpine .

bin/build_ocamlbuild

Lines changed: 0 additions & 1 deletion
This file was deleted.

bin/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
W=/workspace
22
# Create container
33
BUILD="ocamlbuild -quiet -use-ocamlfind cwtest.native"
4-
C=$(docker container create --rm -w $W ocaml:latest sh -c "$BUILD && exec ./cwtest.native")
4+
C=$(docker container create --rm -w $W ocaml:alpine sh -c "$BUILD && exec ./cwtest.native")
55

66
# Copy files
77
docker container cp ${1:-examples/basic}/. $C:$W

bin/run_ocamlbuild

Lines changed: 0 additions & 11 deletions
This file was deleted.

bin/ubuntu_build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker build -f DockerfileUbuntu -t ocaml:ubuntu .

bin/ubuntu_run

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
W=/workspace
2+
# Create container
3+
BUILD="ocamlbuild -quiet -use-ocamlfind cwtest.native"
4+
C=$(docker container create --rm -w $W ocaml:ubuntu sh -c "$BUILD && exec ./cwtest.native")
5+
6+
# Copy files
7+
docker container cp ${1:-examples/basic}/. $C:$W
8+
9+
# Start
10+
docker container start --attach $C

0 commit comments

Comments
 (0)