-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (49 loc) · 1.81 KB
/
Copy pathDockerfile
File metadata and controls
59 lines (49 loc) · 1.81 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
FROM gradescope/autograder-base:ubuntu-jammy-jdk17
# Install uv package manager
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Install packages
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get clean all -y
RUN apt-get update -y &&\
apt-get install -y\
build-essential cmake\
dos2unix\
neovim\
golang\
python3 python3-pip python3-dev\
rustc cargo\
ocaml opam dune\
ghc cabal-install\
git
WORKDIR /
ENV EXPECTED_HASH="b1c0900d2fd0211ae91f03d8680ba27b -"
RUN git clone https://github.com/kishy-codes/nand2tetris.git
RUN test "$EXPECTED_HASH" = "$(git -C nand2tetris log -n 1 | md5sum)"
RUN chmod ug+x /nand2tetris/tools/*.sh
RUN ln -s /nand2tetris/tools/Assembler.sh /usr/bin/n2tAssembler
RUN ln -s /nand2tetris/tools/HardwareSimulator.sh /usr/bin/n2tHardwareSimulator
RUN ln -s /nand2tetris/tools/VMEmulator.sh /usr/bin/n2tVMEmulator
RUN ln -s /nand2tetris/tools/CPUEmulator.sh /usr/bin/n2tCPUEmulator
RUN ln -s /nand2tetris/tools/JackCompiler.sh /usr/bin/n2tJackCompiler
WORKDIR /autograder/grader
# Install dependencies
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --locked --no-install-project
# Copy the project into the image
ADD . /autograder/grader
ADD run_autograder /autograder/run_autograder
# Sync the project
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked
# Setup unprivileged user
RUN adduser student --no-create-home --disabled-password --gecos ""
# Configure access to directories
RUN mkdir -p /autograder/submission
RUN mkdir -p /autograder/results
RUN mkdir /autograder/source
RUN chmod o= /autograder/grader
RUN chmod o= /autograder/submission
RUN chmod o= /autograder/results
RUN chmod -R ugo+rwx /autograder/source