Files
snek/Dockerfile
T
retoor 1ac7ef8b0d feat: add Dockerfile, compose.yml, gunicorn config, http utilities, and static assets
Add Dockerfile with wkhtmltopdf multi-stage build and gunicorn entrypoint for production deployment. Introduce compose.yml with volume sync for development. Switch Makefile from snek.serve to gunicorn with aiohttp worker. Extend Application class with CORS middleware, static file serving, login/test/http-get/http-photo routes, and template rendering. Create gunicorn.py entrypoint, http.py module with async URL fetching, screenshot generation via imgkit, link repair, and CRC32-based caching. Add middleware.py with CORS handlers. Include static assets: app.js with Message/Room/App classes, html_frame.css/js custom element, and prachtig-gitter_like.html UI template. Update setup.cfg dependencies with beautifulsoup4, gunicorn, imgkit, wkhtmltopdf. Add *.png to .gitignore.
2025-01-18 12:21:38 +00:00

41 lines
1.0 KiB
Docker

FROM surnet/alpine-wkhtmltopdf:3.21.2-0.12.6-full as wkhtmltopdf
FROM python:3.10-alpine
WORKDIR /code
ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
RUN apk add --no-cache gcc musl-dev linux-headers git
#WKHTMLTOPDFNEEDS
RUN apk add --no-cache \
libstdc++ \
libx11 \
libxrender \
libxext \
libssl3 \
ca-certificates \
fontconfig \
freetype \
ttf-dejavu \
ttf-droid \
ttf-freefont \
ttf-liberation \
# more fonts
&& apk add --no-cache --virtual .build-deps \
msttcorefonts-installer \
# Install microsoft fonts
&& update-ms-fonts \
&& fc-cache -f \
# Clean up when done
&& rm -rf /tmp/* \
&& apk del .build-deps
COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf
COPY --from=wkhtmltopdf /bin/wkhtmltoimage /bin/wkhtmltoimage
COPY setup.cfg setup.cfg
COPY pyproject.toml pyproject.toml
COPY src src
RUN pip install --upgrade pip
RUN pip install -e .
EXPOSE 8081
CMD ["gunicorn", "-w", "10", "-k", "aiohttp.worker.GunicornWebWorker", "snek.gunicorn:app","--bind","0.0.0.0:8081"]