forked from PrairieLearn/PrairieLearn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (43 loc) · 2.16 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (43 loc) · 2.16 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
FROM amazonlinux:2023.12.20260727.0
ARG CACHEBUST=2026-08-15-14-04-29
WORKDIR /PrairieLearn
COPY --parents scripts/pl-install.sh /PrairieLearn/
RUN /bin/bash /PrairieLearn/scripts/pl-install.sh
# Ensure that running Python in the container will use the correct Python version.
ENV PATH="/PrairieLearn/.venv/bin:/PrairieLearn/node_modules/.bin:$PATH"
# - Ensure that all `uv` commands compile Python source files to bytecode.
# - Ensure that all `uv` commands do not use any caching.
ENV UV_COMPILE_BYTECODE=1 UV_NO_CACHE=1
# We copy `pyproject.toml` and the `Makefile` since we need to install Python dependencies.
COPY --parents pyproject.toml Makefile /PrairieLearn/
RUN make python-deps-core
# This copies in all the `package.json` files in `apps` and `packages`, which
# pnpm needs to correctly install all dependencies in our workspaces.
#
# We also need to copy the `pnpm-workspace.yaml` file, which is necessary for
# pnpm to correctly install dependencies.
#
# Finally, we copy `packages/bind-mount/` since this package contains native
# code that will be built during the install process.
COPY --parents pnpm-lock.yaml pnpm-workspace.yaml package.json apps/*/package.json packages/*/package.json packages/bind-mount/ packages/*/bin/ /PrairieLearn/
# Install Node dependencies.
RUN pnpm install --frozen-lockfile && pnpm store prune
# NOTE: Modify .dockerignore to allowlist files/directories to copy.
COPY . .
# set up PrairieLearn and run migrations to initialize the DB
# hadolint ignore=SC3009
RUN chmod +x /PrairieLearn/scripts/init.sh \
&& mkdir /course{,{2..9}} \
&& mkdir -p /workspace_{main,host}_zips \
&& mkdir -p /jobs \
&& /PrairieLearn/scripts/start_postgres.sh \
&& make build \
&& node apps/prairielearn/dist/server.js --migrate-and-exit \
&& su postgres -c "createuser -s root" \
&& /PrairieLearn/scripts/start_postgres.sh stop \
&& /PrairieLearn/scripts/gen_ssl.sh \
&& git config --global user.email "dev@example.com" \
&& git config --global user.name "Dev User" \
&& git config --global safe.directory '*'
HEALTHCHECK CMD ["curl", "--fail", "http://localhost:3000/pl/webhooks/ping"]
CMD [ "/PrairieLearn/scripts/init.sh" ]