-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (43 loc) · 1.68 KB
/
Dockerfile
File metadata and controls
52 lines (43 loc) · 1.68 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
FROM node:20 as theme-builder
# Copy all themes into the image
COPY themes /tmp/themes
# Automatically build the themes, to ensure up-to-date assets
RUN for theme in /tmp/themes/*; do \
if [ -f "$theme/package.json" ]; then \
echo "Building theme: $theme"; \
cd "$theme" && \
npm install && \
npm run build && \
rm -rf node_modules; \
else \
echo "No build step for theme: $theme"; \
fi; \
done;
FROM ghcr.io/ctfd/ctfd:3.7.7 as ctfd
# Copy plugins from the repository into the image
COPY plugins /tmp/plugins
# Copy the contents of the plugin directory, if it does not contian a src directory, into the /opt/CTFd/CTFd/plugins directory
RUN for plugin in /tmp/plugins/*; do \
if [ -d "$plugin/src" ]; then \
echo "Copying $plugin/src to /opt/CTFd/CTFd/plugins/$(basename $plugin)"; \
cp -r "$plugin/src" /opt/CTFd/CTFd/plugins/$(basename $plugin); \
else \
echo "Copying $plugin to /opt/CTFd/CTFd/plugins/$(basename $plugin)"; \
cp -r "$plugin" /opt/CTFd/CTFd/plugins/$(basename $plugin); \
fi; \
done; \
# If the plugins src directory contians a requirements.txt file, install the dependencies
for d in /opt/CTFd/CTFd/plugins/*/; do \
if [ -f $d/requirements.txt ]; then \
pip install -r $d/requirements.txt; \
fi; \
done;
# Copy theme
COPY --from=theme-builder /tmp/themes /opt/CTFd/CTFd/themes
# Delete line 30 of /opt/CTFd/CTFd/utils/__init__.py in order to smooth development of themes (cache of assets)
ARG DEVELOPMENT=false
RUN if [ "$DEVELOPMENT" = "true" ]; then \
sed -i '30d' /opt/CTFd/CTFd/utils/__init__.py; \
fi
# Overwrite /opt/CTFd/CTFd with the contents from CTFd
COPY CTFd /opt/CTFd/CTFd