-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathdockerfile
More file actions
62 lines (47 loc) · 1.89 KB
/
dockerfile
File metadata and controls
62 lines (47 loc) · 1.89 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
57
58
59
60
61
62
# USAGE
# docker build -t fantom .
#
# The following build args are accepted, with documentation:
# - JDK_VERSION: The version of the JDK to use. Defaults to 17.
# - SWT_DL_URL: The URL to download the SWT jar from. Defaults to 4.27. Be sure that this is compatible with your JDK version.
# - REL_VERSION: The version name of Fantom to use to bootstrap. Defaults to fantom-1.0.77.
# - REL_TAG: The tag of Fantom to use to bootstrap. Be sure that matches REL_VERSION. Defaults to v1.0.77.
# ================================
# Bootstrap image
# ================================
# This image builds the local Fantom installation using the Fantom Bootstrap process.
#
# It mirrors the Bootstrap.fan script, but does not use it (since we want to use the
# local fantom, not one pulled via git).
ARG JDK_VERSION=17
FROM eclipse-temurin:$JDK_VERSION AS bootstrap
WORKDIR /work
ARG FAN_REL_VER=1.0.82
# Build Fantom from source
RUN <<EOF
apt-get -q update
apt-get -q install -y curl unzip
curl -fsSL https://github.com/fantom-lang/fantom/releases/download/v${FAN_REL_VER}/fantom-${FAN_REL_VER}.zip -o fantom.zip
unzip fantom.zip
mv fantom-${FAN_REL_VER} rel
chmod +x rel/bin/*
chmod +x rel/adm/*
EOF
COPY . ./fan/
RUN <<EOF
echo "\n\njdkHome=${JAVA_HOME}/\ndevHome=/work/fan/\n" >> rel/etc/build/config.props
echo "\n\njdkHome=${JAVA_HOME}/" >> fan/etc/build/config.props
rel/bin/fan fan/src/buildall.fan superclean
rel/bin/fan fan/src/buildboot.fan compile
fan/bin/fan fan/src/buildpods.fan compile
EOF
# The /work/fan directory now contains a compiled version of the local Fantom
# ================================
# Run image
# ================================
# This simply copies the new Fantom into a fresh container and sets up the path.
FROM eclipse-temurin:$JDK_VERSION AS run
COPY --from=bootstrap /work/fan/ /opt/fan/
ENV PATH=$PATH:/opt/fan/bin
# Return Fantom's version
CMD ["fan","-version"]