mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 14:04:20 +01:00
Docker Compose files and adjustments
This commit is contained in:
@@ -3,10 +3,11 @@ RUN apk update && apk upgrade
|
|||||||
RUN apk add git gcc musl-dev libffi-dev python python-dev py-pip
|
RUN apk add git gcc musl-dev libffi-dev python python-dev py-pip
|
||||||
|
|
||||||
RUN mkdir /opt
|
RUN mkdir /opt
|
||||||
RUN git clone https://github.com/isislab/CTFd.git /opt/CTFd && cd /opt/CTFd
|
COPY . /opt/CTFd
|
||||||
WORKDIR /opt/CTFd
|
WORKDIR /opt/CTFd
|
||||||
|
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
RUN pip install pymysql
|
||||||
|
|
||||||
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "-w", "4", "CTFd:create_app()"]
|
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "-w", "4", "CTFd:create_app()"]
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|||||||
15
docker-compose-run.sh
Executable file
15
docker-compose-run.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
sed "s;sqlite:///ctfd.db;mysql+pymysql://${MYSQL_USER}:${MYSQL_PASSWORD}@db/ctfd;g" CTFd/config.py -i
|
||||||
|
|
||||||
|
# wait for mysql to start
|
||||||
|
while ! nc db 3306 >/dev/null 2>&1 < /dev/null; do
|
||||||
|
if [ $i -ge 50 ]; then
|
||||||
|
echo "$(date) - db:3306 still not reachable, giving up"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "$(date) - waiting for db:3306..."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
gunicorn --bind 0.0.0.0:8000 -w 4 "CTFd:create_app()"
|
||||||
30
docker-compose.yml
Normal file
30
docker-compose.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
ctfd:
|
||||||
|
build: .
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- &MU MYSQL_USER=ctfd
|
||||||
|
- &MP MYSQL_PASSWORD=You_Should_Probably_Override_This
|
||||||
|
- &MD MYSQL_DATABASE=ctfd
|
||||||
|
command: sh docker-compose-run.sh
|
||||||
|
volumes_from:
|
||||||
|
- data:rw
|
||||||
|
links:
|
||||||
|
- db
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mariadb
|
||||||
|
environment:
|
||||||
|
- *MU
|
||||||
|
- *MP
|
||||||
|
- *MD
|
||||||
|
- MYSQL_ROOT_PASSWORD=Unencrypted_Credentials_At_Rest
|
||||||
|
volumes_from:
|
||||||
|
- data:rw
|
||||||
|
|
||||||
|
data:
|
||||||
|
image: mariadb
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- /var/lib/mysql
|
||||||
|
- /opt/CTFd/CTFd/logs
|
||||||
|
command: "tail -f /dev/null"
|
||||||
Reference in New Issue
Block a user