Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (41 loc) · 1.66 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (41 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
ARG NETLOGO_VERSION=7.0.4
# file exists at
# https://downloads.netlogo.org/7.0.4/NetLogo-7.0.4-64.tgz
ARG NETLOGO_DOWNLOAD_URL=https://downloads.netlogo.org
# ---- Builder stage: download, verify, and smoke-test NetLogo ----
FROM eclipse-temurin:17-jre-jammy AS builder
ARG NETLOGO_VERSION
ARG NETLOGO_DOWNLOAD_URL
ENV DEBIAN_FRONTEND=noninteractive \
NETLOGO_HOME=/opt/netlogo \
NETLOGO_TARBALL=NetLogo-${NETLOGO_VERSION}-64.tgz
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates wget \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /opt
COPY checksums/${NETLOGO_TARBALL}.sha256 /tmp/${NETLOGO_TARBALL}.sha256
RUN wget -O "/tmp/${NETLOGO_TARBALL}" \
"${NETLOGO_DOWNLOAD_URL}/${NETLOGO_VERSION}/${NETLOGO_TARBALL}" \
&& cd /tmp \
&& sha256sum --check --strict "${NETLOGO_TARBALL}.sha256" \
&& tar -xzf "${NETLOGO_TARBALL}" \
&& rm "${NETLOGO_TARBALL}" "${NETLOGO_TARBALL}.sha256" \
&& mv "NetLogo ${NETLOGO_VERSION}" "${NETLOGO_HOME}"
# Copy example model for build-time verification only
COPY examples /opt/examples
# Smoke test: verify NetLogo runs headless before promoting to final image
RUN /opt/netlogo/netlogo-headless.sh \
--model /opt/examples/wolf-sheep-sd.nlogox \
--experiment "smoke test" \
--table /dev/null
# ---- Final stage: minimal image with only NetLogo (no examples) ----
FROM eclipse-temurin:17-jre-jammy
LABEL maintainer="Allen Lee <allen.lee@asu.edu>"
ENV DEBIAN_FRONTEND=noninteractive \
LC_ALL=C.UTF-8 \
LANG=C.UTF-8 \
NETLOGO_HOME=/opt/netlogo \
PATH=/opt/netlogo:${PATH}
COPY --from=builder /opt/netlogo /opt/netlogo
WORKDIR /work
ENTRYPOINT ["/opt/netlogo/netlogo-headless.sh"]