-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDockerfile.openwebui
More file actions
53 lines (41 loc) · 1.38 KB
/
Dockerfile.openwebui
File metadata and controls
53 lines (41 loc) · 1.38 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
FROM ghcr.io/open-webui/open-webui:main
# Create CTF flag in the data directory
# This will be in the container's filesystem, but the volume mount will override it
# So we need to handle this differently - we'll create an init script
RUN mkdir -p /docker-entrypoint-init.d
RUN cat > /docker-entrypoint-init.d/01-create-ctf-flag.sh << 'EOF'
#!/bin/bash
# This script runs on container startup to ensure the CTF flag exists
CTF_DIR="/app/backend/data/ctf"
FLAG_FILE="$CTF_DIR/flag.txt"
# Create CTF directory if it doesn't exist
if [ ! -d "$CTF_DIR" ]; then
mkdir -p "$CTF_DIR"
echo "Created CTF directory: $CTF_DIR"
fi
# Create flag file if it doesn't exist
if [ ! -f "$FLAG_FILE" ]; then
echo "{flag:${CTF_FLAG_CHALLENGE_8}}" > "$FLAG_FILE"
chmod 644 "$FLAG_FILE"
echo "Created CTF flag at: $FLAG_FILE"
else
echo "CTF flag already exists at: $FLAG_FILE"
fi
EOF
RUN chmod +x /docker-entrypoint-init.d/01-create-ctf-flag.sh
# Create a custom entrypoint that runs our init scripts
RUN cat > /custom-entrypoint.sh << 'EOF'
#!/bin/bash
set -e
# Run all init scripts
for script in /docker-entrypoint-init.d/*.sh; do
if [ -f "$script" ] && [ -x "$script" ]; then
echo "Running init script: $script"
"$script"
fi
done
# Execute the original entrypoint
exec /app/backend/start.sh "$@"
EOF
RUN chmod +x /custom-entrypoint.sh
ENTRYPOINT ["/custom-entrypoint.sh"]