mirror of https://github.com/JohnHammond/CTFd.git
Prune down docker image (#1286)
* Improve `Dockerfile` to run fewer commands and re-use the build cache Co-authored-by: Joe Atzberger <atz@corelight.com> Co-authored-by: Kevin Chung <kchung@nyu.edu>bulk-clear-sessions
parent
464f7bde58
commit
123d72ac80
|
@ -5,3 +5,10 @@ CTFd/*.db
|
|||
CTFd/uploads/**/*
|
||||
.ctfd_secret_key
|
||||
.data
|
||||
.git
|
||||
.codecov.yml
|
||||
.dockerignore
|
||||
.github
|
||||
.gitignore
|
||||
.prettierignore
|
||||
.travis.yml
|
||||
|
|
31
Dockerfile
31
Dockerfile
|
@ -1,26 +1,33 @@
|
|||
FROM python:3.7-alpine
|
||||
RUN apk update && \
|
||||
apk add python python-dev linux-headers libffi-dev gcc make musl-dev py-pip mysql-client git openssl-dev
|
||||
RUN adduser -D -u 1001 -s /bin/bash ctfd
|
||||
|
||||
WORKDIR /opt/CTFd
|
||||
RUN mkdir -p /opt/CTFd /var/log/CTFd /var/uploads
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
RUN apk update && \
|
||||
apk add \
|
||||
python \
|
||||
python-dev \
|
||||
linux-headers \
|
||||
libffi-dev \
|
||||
gcc \
|
||||
make \
|
||||
musl-dev \
|
||||
py-pip \
|
||||
mysql-client \
|
||||
git \
|
||||
openssl-dev
|
||||
|
||||
COPY . /opt/CTFd
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
RUN for d in CTFd/plugins/*; do \
|
||||
if [ -f "$d/requirements.txt" ]; then \
|
||||
pip install -r $d/requirements.txt; \
|
||||
fi; \
|
||||
if [ -f "$d/requirements.txt" ]; then \
|
||||
pip install -r $d/requirements.txt; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
RUN chmod +x /opt/CTFd/docker-entrypoint.sh
|
||||
RUN chown -R 1001:1001 /opt/CTFd
|
||||
RUN chown -R 1001:1001 /var/log/CTFd /var/uploads
|
||||
RUN adduser -D -u 1001 -s /bin/sh ctfd
|
||||
RUN chown -R 1001:1001 /opt/CTFd /var/log/CTFd /var/uploads
|
||||
|
||||
USER 1001
|
||||
EXPOSE 8000
|
||||
|
|
Loading…
Reference in New Issue