forked from udem-dlteam/pnut
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
70 lines (58 loc) · 1.77 KB
/
Dockerfile
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
63
64
65
66
67
68
69
70
# The source of the pnut repository, either git or from local directory
ARG PNUT_SOURCE=clone
# Works on both x86 and ARM
FROM ubuntu:24.04 AS base
RUN apt-get update && apt-get install -y \
# Includes gcc and make
build-essential \
# To clone the repository if needed
git \
# To measure the time of the execution
time \
# Install all tested shells
bash dash ksh zsh mksh yash \
# To create Debian woody environment
debootstrap
# Create a Debian woody environment to test bash-2.05a
# The woody environment is done in 2 steps to cache this expensive step
RUN \
# Create a Debian woody environment
debootstrap --arch=i386 woody woody http://archive.debian.org/debian; \
# Install gcc and time utils
chroot woody /bin/bash -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential time timeout";
# Clone repository
FROM base AS pnut_from_clone
RUN git clone https://github.com/udem-dlteam/pnut.git --depth 1 /pnut
# Copy repository from local directory
# Mainly used for development to avoid having to commit and push changes
FROM base AS pnut_from_local
COPY . /pnut
# Copy the pnut repository from the source, either git or local directory
FROM pnut_from_${PNUT_SOURCE} AS with_pnut
# Copy pnut into the woody environment, then move it in the main pnut directory
RUN cp -r pnut ../woody/pnut; mv ../woody pnut
# Set the working directory
WORKDIR /pnut
# Create woody.sh script to enter the woody environment
COPY woody.sh .
RUN cat > fib.c <<EOF
int fib(int n) {
if (n < 2) {
return n;
} else {
return fib(n - 1) + fib(n - 2);
}
}
void main() {
int n;
int i;
i = 15;
while (i < 20) {
n = fib(i);
printf("fib(%d) = %d\n", i, n);
i++;
}
}
EOF
# Start in bash
ENTRYPOINT ["/bin/bash"]