Skip to content

Commit

Permalink
Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mbuechner committed May 12, 2022
1 parent 6edef7b commit d125e0b
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM python:3.10-alpine
MAINTAINER Michael Büchner <[email protected]>
ARG MEMEGEN_GIT_HASH=afefed2952658d9d2da78489aed493d964103400
RUN apk add \
freetype-dev \
jpeg-dev \
openjpeg \
libimagequant \
libjpeg-turbo \
Expand All @@ -16,14 +18,12 @@ RUN apk add \
dpkg-dev dpkg \
expat-dev \
findutils \
freetype-dev \
fribidi-dev \
g++ \
gcc \
git \
gdbm-dev \
harfbuzz-dev \
jpeg-dev \
lcms2-dev \
libapparmor \
libc-dev \
Expand Down Expand Up @@ -52,6 +52,7 @@ RUN apk add \
wget -O /home/memegen.zip https://github.com/jacebrowning/memegen/archive/$MEMEGEN_GIT_HASH.zip && \
unzip /home/memegen.zip -d /home && \
mv /home/memegen-$MEMEGEN_GIT_HASH/ /home/memegen/ && \
sed -i 's/Memegen.link/DDBmeme/g' /home/memegen/app/settings.py && \
rm -f /home/memegen.zip;

WORKDIR /home/memegen
Expand All @@ -63,25 +64,20 @@ ENV RUN_GROUP 0
RUN mkdir .venv/ && \
chown -R ${RUN_USER}:${RUN_GROUP} . && \
python3 -m pip install --no-cache --upgrade pipenv poetry && \
{ \
echo "WEB_CONCURRENCY=2"; \
echo "MAX_REQUESTS=0"; \
echo "MAX_REQUESTS_JITTER=0"; \
echo "WATERMARK_OPTIONS=blank,DDBmeme"; \
} > .env && \
pipenv install && \
pipenv run poetry install;

# add supervisord config
COPY --chown=${RUN_USER}:${RUN_GROUP} config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# add DDBmeme and build it
COPY --chown=${RUN_USER}:${RUN_GROUP} DDBmeme/ /home/ddbmeme/
WORKDIR /home/ddbmeme
RUN mkdir .venv/ && \
pipenv install && \
pipenv run python manage.py migrate && \
apk del --no-network .build-deps && \
pipenv run python manage.py migrate;

# add supervisord config
COPY --chown=${RUN_USER}:${RUN_GROUP} config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

RUN apk del --no-network .build-deps && \
touch /run/supervisord.pid && chgrp -R ${RUN_GROUP} /run/supervisord.pid && chmod -R g=u /run/supervisord.pid;

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
Expand Down

0 comments on commit d125e0b

Please sign in to comment.