summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/.dockerignore15
-rw-r--r--server/.vscode/settings.json7
-rw-r--r--server/Dockerfile102
-rwxr-xr-xserver/start.sh5
4 files changed, 5 insertions, 124 deletions
diff --git a/server/.dockerignore b/server/.dockerignore
deleted file mode 100644
index cdfeafc..0000000
--- a/server/.dockerignore
+++ /dev/null
@@ -1,15 +0,0 @@
-# Linter configs
-pyproject.toml
-.flake8
-
-# Python requirements files
-requirements.txt
-dev-requirements.txt
-
-# Docker build files
-Dockerfile
-.dockerignore
-hooks/
-
-# User configured config file
-config.yaml
diff --git a/server/.vscode/settings.json b/server/.vscode/settings.json
deleted file mode 100644
index 0d1666f..0000000
--- a/server/.vscode/settings.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "python.testing.pytestArgs": [
- "szurubooru"
- ],
- "python.testing.unittestEnabled": false,
- "python.testing.pytestEnabled": true
-} \ No newline at end of file
diff --git a/server/Dockerfile b/server/Dockerfile
deleted file mode 100644
index 3e4dadf..0000000
--- a/server/Dockerfile
+++ /dev/null
@@ -1,102 +0,0 @@
-ARG ALPINE_VERSION=3.13
-
-
-FROM alpine:$ALPINE_VERSION as prereqs
-WORKDIR /opt/app
-
-RUN apk --no-cache add \
- python3 \
- python3-dev \
- py3-pip \
- build-base \
- libheif \
- libheif-dev \
- libavif \
- libavif-dev \
- ffmpeg \
- # from requirements.txt:
- py3-yaml \
- py3-psycopg2 \
- py3-sqlalchemy \
- py3-certifi \
- py3-numpy \
- py3-pillow \
- py3-pynacl \
- py3-tz \
- py3-pyrfc3339
-RUN pip3 install --no-cache-dir --disable-pip-version-check \
- "alembic>=0.8.5" \
- "coloredlogs==5.0" \
- "pyheif==0.6.1" \
- "heif-image-plugin>=0.3.2" \
- yt-dlp \
- "pillow-avif-plugin~=1.1.0"
-RUN apk --no-cache del py3-pip
-
-COPY ./ /opt/app/
-RUN rm -rf /opt/app/szurubooru/tests
-
-
-FROM --platform=$BUILDPLATFORM prereqs as testing
-WORKDIR /opt/app
-
-RUN apk --no-cache add \
- py3-pip \
- py3-pytest \
- py3-pytest-cov \
- postgresql \
- && pip3 install --no-cache-dir --disable-pip-version-check \
- pytest-pgsql \
- freezegun \
- && 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
-
-ARG PUID=1000
-ARG PGID=1000
-
-RUN apk --no-cache add \
- dumb-init \
- py3-setuptools \
- py3-waitress \
- && 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"]
-
-ARG PORT=6666
-ENV PORT=${PORT}
-EXPOSE ${PORT}
-
-ARG THREADS=4
-ENV THREADS=${THREADS}
-
-VOLUME ["/data/"]
-
-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"
diff --git a/server/start.sh b/server/start.sh
new file mode 100755
index 0000000..30d4b64
--- /dev/null
+++ b/server/start.sh
@@ -0,0 +1,5 @@
+#!//bin/sh
+set -e
+alembic upgrade head
+echo "Starting szurubooru API on port ${PORT} - Running on ${THREADS} threads"
+exec waitress-serve --port ${PORT} --threads ${THREADS} szurubooru.facade:app