2020-08-28 20:43:10 +02:00
|
|
|
ARG ALPINE_VERSION=3.12
|
|
|
|
|
|
|
|
|
|
|
|
FROM alpine:$ALPINE_VERSION as prereqs
|
2018-07-12 05:30:13 +02:00
|
|
|
WORKDIR /opt/app
|
|
|
|
|
2020-08-28 20:43:10 +02:00
|
|
|
RUN apk --no-cache add \
|
2019-09-30 00:39:16 +02:00
|
|
|
python3 \
|
|
|
|
ffmpeg \
|
2020-06-04 22:38:26 +02:00
|
|
|
py3-pip \
|
2019-09-30 00:39:16 +02:00
|
|
|
# from requirements.txt:
|
|
|
|
py3-yaml \
|
|
|
|
py3-psycopg2 \
|
|
|
|
py3-sqlalchemy \
|
|
|
|
py3-certifi \
|
|
|
|
py3-numpy \
|
|
|
|
py3-pillow \
|
|
|
|
py3-pynacl \
|
|
|
|
py3-tz \
|
2020-01-12 18:29:25 +01:00
|
|
|
py3-pyrfc3339 \
|
2020-08-28 20:43:10 +02:00
|
|
|
&& pip3 install --no-cache-dir --disable-pip-version-check \
|
2019-09-30 00:39:16 +02:00
|
|
|
alembic \
|
|
|
|
"coloredlogs==5.0" \
|
2020-04-02 22:17:26 +02:00
|
|
|
youtube-dl \
|
2020-08-28 20:43:10 +02:00
|
|
|
&& apk --no-cache del py3-pip
|
|
|
|
|
|
|
|
COPY ./ /opt/app/
|
|
|
|
RUN rm -rf /opt/app/szurubooru/tests
|
|
|
|
|
|
|
|
|
|
|
|
FROM prereqs as testing
|
|
|
|
WORKDIR /opt/app
|
|
|
|
|
|
|
|
RUN apk --no-cache add \
|
2020-09-01 20:06:22 +02:00
|
|
|
py3-pip \
|
|
|
|
py3-pytest \
|
2020-08-28 20:43:10 +02:00
|
|
|
py3-pytest-cov \
|
|
|
|
postgresql \
|
|
|
|
&& pip3 install --no-cache-dir --disable-pip-version-check \
|
2020-09-01 20:06:22 +02:00
|
|
|
pytest-pgsql \
|
|
|
|
freezegun \
|
2020-08-28 20:43:10 +02:00
|
|
|
&& apk --no-cache del py3-pip \
|
|
|
|
&& addgroup app \
|
|
|
|
&& adduser -SDH -h /opt/app -g '' -G app app \
|
|
|
|
&& chown app:app /opt/app
|
|
|
|
|
|
|
|
COPY --chown=app:app ./szurubooru/tests /opt/app/szurubooru/tests/
|
|
|
|
|
|
|
|
ENV TEST_ENVIRONMENT="true"
|
|
|
|
USER app
|
|
|
|
ENTRYPOINT ["pytest", "--tb=short"]
|
|
|
|
CMD ["szurubooru/"]
|
|
|
|
|
|
|
|
|
|
|
|
FROM prereqs as release
|
|
|
|
WORKDIR /opt/app
|
2018-07-12 05:30:13 +02:00
|
|
|
|
2019-09-28 05:15:34 +02:00
|
|
|
ARG PUID=1000
|
|
|
|
ARG PGID=1000
|
2018-07-12 05:30:13 +02:00
|
|
|
|
2020-08-28 20:43:10 +02:00
|
|
|
RUN apk --no-cache add \
|
2020-09-01 20:06:22 +02:00
|
|
|
dumb-init \
|
|
|
|
py3-setuptools \
|
|
|
|
py3-waitress \
|
2020-08-28 20:43:10 +02:00
|
|
|
&& mkdir -p /opt/app /data \
|
|
|
|
&& addgroup -g ${PGID} app \
|
|
|
|
&& adduser -SDH -h /opt/app -g '' -G app -u ${PUID} app \
|
|
|
|
&& chown -R app:app /opt/app /data
|
|
|
|
|
|
|
|
USER app
|
|
|
|
CMD ["/opt/app/docker-start.sh"]
|
2019-09-30 00:39:16 +02:00
|
|
|
|
|
|
|
ARG PORT=6666
|
|
|
|
ENV PORT=${PORT}
|
2018-07-12 05:30:13 +02:00
|
|
|
EXPOSE ${PORT}
|
2020-08-28 20:43:10 +02:00
|
|
|
|
2019-09-28 05:15:34 +02:00
|
|
|
VOLUME ["/data/"]
|
2019-10-05 00:58:05 +02:00
|
|
|
|
|
|
|
ARG DOCKER_REPO
|
|
|
|
ARG BUILD_DATE
|
|
|
|
ARG SOURCE_COMMIT
|
|
|
|
LABEL \
|
|
|
|
maintainer="" \
|
|
|
|
org.opencontainers.image.title="${DOCKER_REPO}" \
|
|
|
|
org.opencontainers.image.url="https://github.com/rr-/szurubooru" \
|
|
|
|
org.opencontainers.image.documentation="https://github.com/rr-/szurubooru/blob/${SOURCE_COMMIT}/doc/INSTALL.md" \
|
|
|
|
org.opencontainers.image.created="${BUILD_DATE}" \
|
|
|
|
org.opencontainers.image.source="https://github.com/rr-/szurubooru" \
|
|
|
|
org.opencontainers.image.revision="${SOURCE_COMMIT}" \
|
|
|
|
org.opencontainers.image.licenses="GPL-3.0"
|