forked from PrairieLearn/PrairieLearn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
41 lines (36 loc) · 1.56 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
FROM prairielearn/plbase
ENV PATH="/PrairieLearn/node_modules/.bin:$PATH"
# Install Python/NodeJS dependencies before copying code to limit download size
# when code changes.
#
# Note that we also have to copy the `packages` directory so that `yarn`
# can resolve the workspaces inside it and set up symlinks correctly.
# This is suboptimal, as a change to any file under `package/` will
# invalidate this layer's cache, but it's unavoidable.
#
# We also need to copy both the `.yarn` directory and the `.yarnrc.yml` file,
# both of which are necessary for Yarn to correctly install dependencies.
COPY packages/ /PrairieLearn/packages/
COPY .yarn/ /PrairieLearn/.yarn/
COPY package.json yarn.lock .yarnrc.yml /PrairieLearn/
RUN cd /PrairieLearn \
&& yarn install --immutable \
&& yarn cache clean
# NOTE: Modify .dockerignore to allowlist files/directories to copy.
COPY . /PrairieLearn/
# set up PrairieLearn and run migrations to initialize the DB
RUN chmod +x /PrairieLearn/docker/init.sh \
&& mkdir /course{,{2..9}} \
&& mkdir -p /workspace_{main,host}_zips \
&& mkdir -p /jobs \
&& /PrairieLearn/docker/start_postgres.sh \
&& cd /PrairieLearn \
&& make build \
&& node server.js --migrate-and-exit \
&& su postgres -c "createuser -s root" \
&& /PrairieLearn/docker/start_postgres.sh stop \
&& /PrairieLearn/docker/gen_ssl.sh \
&& git config --global user.email "[email protected]" \
&& git config --global user.name "Dev User"
HEALTHCHECK CMD curl --fail http://localhost:3000/pl/webhooks/ping || exit 1
CMD /PrairieLearn/docker/init.sh