summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.org>2025-10-12 15:08:47 -0400
committerJakob L. Kreuze <zerodaysfordays@sdf.org>2025-10-12 15:08:47 -0400
commit838d80ce274e0634eddafc08bed6d5ba8e0403e1 (patch)
tree07a942203e56f6363983b2d9416cc9ed2b700155
parentf9d5251dd78468d99fbd88eedaacdc4dede1a4cc (diff)
Get rid of Docker artifactsHEADmaster
-rw-r--r--.github/workflows/build-containers.yml108
-rw-r--r--.github/workflows/run-unit-tests.yml28
-rw-r--r--.pre-commit-config.yaml62
-rw-r--r--README.md8
-rw-r--r--client/.dockerignore4
-rw-r--r--client/Dockerfile48
-rwxr-xr-xclient/docker-start.sh11
-rw-r--r--client/nginx.conf.docker101
-rwxr-xr-xdoc/install.sh164
-rw-r--r--docker-compose.test.yml23
-rw-r--r--docker-compose.yml52
-rw-r--r--server/.dockerignore15
-rw-r--r--server/.vscode/settings.json7
-rw-r--r--server/Dockerfile102
-rwxr-xr-xserver/start.sh5
15 files changed, 5 insertions, 733 deletions
diff --git a/.github/workflows/build-containers.yml b/.github/workflows/build-containers.yml
deleted file mode 100644
index c688a5f..0000000
--- a/.github/workflows/build-containers.yml
+++ /dev/null
@@ -1,108 +0,0 @@
-name: Build Docker containers
-on:
- push:
- branches:
- - master
-jobs:
- build-client:
- name: Build and push client/ Docker container
- runs-on: ubuntu-latest
- steps:
- - name: Login to Docker Hub
- uses: docker/login-action@v1
- with:
- username: ${{ secrets.DOCKERHUB_USERNAME }}
- password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
- - name: Checkout
- uses: actions/checkout@v2
- with:
- fetch-depth: 0
-
- - name: Determine metadata
- run: |
- CLOSEST_VER="$(git describe --tags --abbrev=0 $GITHUB_SHA)"
- CLOSEST_MAJOR_VER="$(echo ${CLOSEST_VER} | cut -d'.' -f1)"
- CLOSEST_MINOR_VER="$(echo ${CLOSEST_VER} | cut -d'.' -f2)"
- SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c1-8)
- BUILD_INFO="v${CLOSEST_VER}-${SHORT_COMMIT}"
- BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
-
- echo "major_tag=${CLOSEST_MAJOR_VER}" >> $GITHUB_ENV
- echo "minor_tag=${CLOSEST_MAJOR_VER}.${CLOSEST_MINOR_VER}" >> $GITHUB_ENV
- echo "build_info=${BUILD_INFO}" >> $GITHUB_ENV
- echo "build_date=${BUILD_DATE}" >> $GITHUB_ENV
-
- echo "Build Info: ${BUILD_INFO}"
- echo "Build Date: ${BUILD_DATE}"
-
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v1
-
- - name: Set up Docker Buildx
- id: buildx
- uses: docker/setup-buildx-action@v1
-
- - name: Build container
- run: >
- docker buildx build --push
- --platform linux/amd64,linux/arm/v7,linux/arm64/v8
- --build-arg BUILD_INFO=${{ env.build_info }}
- --build-arg BUILD_DATE=${{ env.build_date }}
- --build-arg SOURCE_COMMIT=$GITHUB_SHA
- --build-arg DOCKER_REPO=szurubooru/client
- -t "szurubooru/client:latest"
- -t "szurubooru/client:${{ env.major_tag }}"
- -t "szurubooru/client:${{ env.minor_tag }}"
- ./client
-
- build-server:
- name: Build and push server/ Docker container
- runs-on: ubuntu-latest
- steps:
- - name: Login to Docker Hub
- uses: docker/login-action@v1
- with:
- username: ${{ secrets.DOCKERHUB_USERNAME }}
- password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
- - name: Checkout
- uses: actions/checkout@v2
- with:
- fetch-depth: 0
-
- - name: Determine metadata
- run: |
- CLOSEST_VER="$(git describe --tags --abbrev=0 $GITHUB_SHA)"
- CLOSEST_MAJOR_VER="$(echo ${CLOSEST_VER} | cut -d'.' -f1)"
- CLOSEST_MINOR_VER="$(echo ${CLOSEST_VER} | cut -d'.' -f2)"
- SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c1-8)
- BUILD_INFO="v${CLOSEST_VER}-${SHORT_COMMIT}"
- BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
-
- echo "major_tag=${CLOSEST_MAJOR_VER}" >> $GITHUB_ENV
- echo "minor_tag=${CLOSEST_MAJOR_VER}.${CLOSEST_MINOR_VER}" >> $GITHUB_ENV
- echo "build_info=${BUILD_INFO}" >> $GITHUB_ENV
- echo "build_date=${BUILD_DATE}" >> $GITHUB_ENV
-
- echo "Build Info: ${BUILD_INFO}"
- echo "Build Date: ${BUILD_DATE}"
-
- - name: Set up QEMU
- uses: docker/setup-qemu-action@v1
-
- - name: Set up Docker Buildx
- id: buildx
- uses: docker/setup-buildx-action@v1
-
- - name: Build container
- run: >
- docker buildx build --push
- --platform linux/amd64,linux/arm/v7,linux/arm64/v8
- --build-arg BUILD_DATE=${{ env.build_date }}
- --build-arg SOURCE_COMMIT=$GITHUB_SHA
- --build-arg DOCKER_REPO=szurubooru/server
- -t "szurubooru/server:latest"
- -t "szurubooru/server:${{ env.major_tag }}"
- -t "szurubooru/server:${{ env.minor_tag }}"
- ./server
diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml
deleted file mode 100644
index 9ea14ed..0000000
--- a/.github/workflows/run-unit-tests.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-name: Run unit tests
-on: [push, pull_request]
-jobs:
- test-server:
- name: Run pytest for server/
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v2
-
- - name: Set up Docker Buildx
- id: buildx
- uses: docker/setup-buildx-action@v1
-
- - name: Build test container
- run: >
- docker buildx build --load
- --platform linux/amd64 --target testing
- -t test_container
- ./server
-
- - name: Run unit tests
- run: >
- docker run --rm -t test_container
- --color=no
- --cov-report=term-missing:skip-covered
- --cov=szurubooru
- szurubooru/
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
deleted file mode 100644
index 75a55d6..0000000
--- a/.pre-commit-config.yaml
+++ /dev/null
@@ -1,62 +0,0 @@
-repos:
-
-- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.4.0
- hooks:
- - id: trailing-whitespace
- - id: end-of-file-fixer
- - id: check-yaml
- - id: mixed-line-ending
-
-
-- repo: https://github.com/Lucas-C/pre-commit-hooks
- rev: v1.4.2
- hooks:
- - id: remove-tabs
-
-- repo: https://github.com/psf/black
- rev: '23.1.0'
- hooks:
- - id: black
- files: 'server/'
- types: [python]
- language_version: python3.9
-
-- repo: https://github.com/PyCQA/isort
- rev: '5.12.0'
- hooks:
- - id: isort
- files: 'server/'
- types: [python]
- exclude: server/szurubooru/migrations/env.py
- additional_dependencies:
- - toml
-
-- repo: https://github.com/pre-commit/mirrors-prettier
- rev: v2.7.1
- hooks:
- - id: prettier
- files: client/js/
- exclude: client/js/.gitignore
- args: ['--config', 'client/.prettierrc.yml']
-
-- repo: https://github.com/pre-commit/mirrors-eslint
- rev: v8.33.0
- hooks:
- - id: eslint
- files: client/js/
- args: ['--fix']
- additional_dependencies:
- - eslint-config-prettier
-
-- repo: https://github.com/PyCQA/flake8
- rev: '6.0.0'
- hooks:
- - id: flake8
- files: server/szurubooru/
- additional_dependencies:
- - flake8-print
- args: ['--config=server/.flake8']
-
-fail_fast: true
-exclude: LICENSE.md
diff --git a/README.md b/README.md
index 6a38501..d53cc01 100644
--- a/README.md
+++ b/README.md
@@ -27,14 +27,6 @@ scrubbing](https://sjp.pwn.pl/sjp/;2527372). It is pronounced as *shoorubooru*.
- Browser configurable endless paging
- Browser configurable backdrop grid for transparent images
-## Installation
-
-It is recommended that you use Docker for deployment.
-[See installation instructions.](doc/INSTALL.md)
-
-More installation resources, as well as related projects can be found on the
-[GitHub project Wiki](https://github.com/rr-/szurubooru/wiki)
-
## Screenshots
Post list:
diff --git a/client/.dockerignore b/client/.dockerignore
deleted file mode 100644
index cc2d280..0000000
--- a/client/.dockerignore
+++ /dev/null
@@ -1,4 +0,0 @@
-node_modules/*
-Dockerfile
-.dockerignore
-**/.gitignore
diff --git a/client/Dockerfile b/client/Dockerfile
deleted file mode 100644
index 1e3926d..0000000
--- a/client/Dockerfile
+++ /dev/null
@@ -1,48 +0,0 @@
-FROM --platform=$BUILDPLATFORM node:lts as builder
-WORKDIR /opt/app
-
-COPY package.json package-lock.json ./
-RUN npm install
-
-COPY . ./
-
-ARG BUILD_INFO="docker-latest"
-ARG CLIENT_BUILD_ARGS="--debug"
-RUN BASE_URL="__BASEURL__" node build.js --gzip ${CLIENT_BUILD_ARGS}
-
-
-FROM --platform=$BUILDPLATFORM nginx:alpine as approot
-
-# Copy and fix script
-COPY docker-start.sh /
-RUN apk add --no-cache dos2unix && \
- dos2unix /docker-start.sh && \
- chmod +x /docker-start.sh
-
-WORKDIR /etc/nginx
-COPY nginx.conf.docker ./nginx.conf
-
-WORKDIR /var/www
-COPY --from=builder /opt/app/public/ .
-
-
-FROM nginx:alpine as release
-
-RUN apk --no-cache add dumb-init
-COPY --from=approot / /
-
-CMD ["/docker-start.sh"]
-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/client/docker-start.sh b/client/docker-start.sh
deleted file mode 100755
index 0b2bec8..0000000
--- a/client/docker-start.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/dumb-init /bin/sh
-
-# Integrate environment variables
-sed -i "s|__BACKEND__|${BACKEND_HOST}|" \
- /etc/nginx/nginx.conf
-sed -i "s|__BASEURL__|${BASE_URL:-/}|g" \
- /var/www/index.htm \
- /var/www/manifest.json
-
-# Start server
-exec nginx
diff --git a/client/nginx.conf.docker b/client/nginx.conf.docker
deleted file mode 100644
index 98c18b3..0000000
--- a/client/nginx.conf.docker
+++ /dev/null
@@ -1,101 +0,0 @@
-worker_processes 1;
-user nginx;
-
-error_log /dev/stderr warn;
-pid /var/run/nginx.pid;
-
-events {
- worker_connections 1024;
-}
-
-http {
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
-
- log_format main '$remote_addr -> $request [$status] - '
- 'referer: $http_referer $http_x_forwarded_for';
- access_log /dev/stdout main;
-
- server_tokens off;
- keepalive_timeout 65;
-
- upstream backend {
- server __BACKEND__:6666;
- }
-
- server {
- listen 80 default_server;
-
- location ~ ^/api$ {
- return 302 /api/;
- }
-
- location ~ ^/api/(.*)$ {
- tcp_nodelay on;
-
- add_header 'Access-Control-Allow-Origin' '*';
- if ($request_method = 'OPTIONS') {
- add_header 'Access-Control-Allow-Methods'
- 'GET, POST, PUT, DELETE, OPTIONS';
- add_header 'Access-Control-Allow-Headers'
- 'Authorization, Content-Type';
- return 200;
- }
-
- client_max_body_size 1073741824;
-
- gzip on;
- gzip_comp_level 3;
- gzip_min_length 20;
- gzip_proxied expired no-cache no-store private auth;
- gzip_types text/plain application/json;
-
- if ($request_uri ~* "/api/(.*)") {
- proxy_pass http://backend/$1;
- }
-
- error_page 500 502 503 504 @badproxy;
- }
-
- location /data/ {
- rewrite ^/data/(.*) /$1 break;
- root /data;
-
- sendfile on;
- tcp_nopush on;
- tcp_nodelay on;
-
- error_page 403 @unauthorized;
- error_page 404 @notfound;
- }
-
- location / {
- root /var/www;
- try_files $uri /index.htm;
-
- sendfile on;
- tcp_nopush on;
- tcp_nodelay on;
-
- gzip_static on;
- gzip_proxied expired no-cache no-store private auth;
- }
-
- location @unauthorized {
- return 403 "Unauthorized";
- default_type text/plain;
- }
-
- location @notfound {
- return 404 "Not Found";
- default_type text/plain;
- }
-
- location @badproxy {
- return 502 "Failed to connect to szurubooru REST API";
- default_type text/plain;
- }
- }
-}
-
-daemon off;
diff --git a/doc/install.sh b/doc/install.sh
deleted file mode 100755
index 89691d5..0000000
--- a/doc/install.sh
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/bin/bash
-
-# NOTE: This script is still a work in progress
-
-# This script is meant to automate the deployment of Szurubooru via Docker/Docker-Compose,
-# and to automatically take the necessary steps to allow Szurubooru to run on ARM devices
-# such as the Raspberry Pi.
-
-###########################################[Notes]###########################################
-# * Written and tested on Raspberry Pi 4 running Raspbian 10 (armv7), heavily based on a fork
-# by kaijuagenda for the Pi 3: https://github.com/kaijuagenda/szurubooru-rpi3
-#
-# * Modifies docker-compose.yml rather than relying on a static alternative file to hopefully
-# avoid the need for parallel maintenance of two files.
-#############################################################################################
-
-# Colorized flags for check status output
-ERROR="[\e[31mERROR\e[0m]"
-OK="[\e[32mOK\e[0m]"
-NOTICE="[\e[33mNOTICE\e[0m]"
-
-echo 'Welcome to Szurubooru. This install script will ask you to set a few basic'\
- 'config values, then get szurubooru up and running.'
-
-echo "Checking a few things to ensure successful deployment..."
-
-# Check to ensure Docker and Docker-Compose are both installed and usable via standard commands
-if ! command -v docker &> /dev/null || ! command -v docker-compose &> /dev/null; then
- echo -e "${ERROR} Both Docker and Docker-Compose must already be installed to use this script."
- echo " Please ensure both are installed and available using commands docker and"
- echo " docker-compose, then run this script again."
- exit 1
-else echo -e "${OK} Docker and Docker-Compose Installation verified"
-fi
-
-# Check to ensure the current user can access the Docker daemon
-# https://github.com/rr-/szurubooru/pull/366#discussion_r541795141
-if [[ "$(docker ps &> /dev/null | echo $?)" > 0 ]]; then
- echo -e "${ERROR} Unable to verify Docker daemon access! Please ensure the current user is"
- echo " authorized for Docker access."
- echo " For more info, see the official Docker documentation at"
- echo " https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user"
- exit 1
-else echo "${OK} Docker Daemon accessible."
-fi
-
-
-########################################################################################
-# Check CPU architectue and, if ARM (such as Raspberry Pi), modify docker-compose.yml
-# https://github.com/rr-/szurubooru/wiki/ARM-and-Raspberry-Pi-Support-for-Docker-builds
-# https://github.com/rr-/szurubooru/blob/master/docker-compose.yml
-########################################################################################
-
-if [[ "$(uname -m)" == 'a'* ]]; then
- echo -e "${NOTICE} ARM architecture detected. Modfying docker-compose.yml for local build."
- # Modify docker-compose file to build locally instead of pulling from dockerhub
- sed -zi "s|image: szurubooru/server:latest|build:\n context: ./server|; \
- s|image: szurubooru/client:latest|build:\n context: ./client|" ./docker-compose.yml
-fi
-
-
-function server_config () {
- ################################################################################################################
- # Copy ./server/config.yaml.dist to ./server/config.yaml, then prompt the user to set the basic config settings
- # https://github.com/rr-/szurubooru/blob/master/doc/INSTALL.md
- ################################################################################################################
-
- cp server/config.yaml.dist server/config.yaml
- echo -e "\n===[General Settings]==="
-
- # Prompt for Secret, proposing a randomly generated 32-character alphanumeric value as a default.
- default_secret="$(tr -dc '[:alnum:]' < /dev/urandom | dd bs=4 count=8 2>/dev/null)"
- echo "Enter your Secret (Used to salt the users' password hashes and generate filenames for static content)"
- read -e -p "> " -i "$default_secret" SECRET
- sed -i "s|secret: change|secret: $SECRET|" ./server/config.yaml
-
- # Other useful (but less important) settings
- echo "Enter the desired name for your server. (Shown in the website title and on the front page)"
- read -e -p "> " -i "szurubooru" SERVERNAME
- echo "Enter the full url to the homepage of this szurubooru site, with no trailing slash."
- read -e -p "> " URL
- sed -i "s|name: szurubooru|name: $SERVERNAME|;s|domain: |domain: $URL|" ./server/config.yaml
-
- # SMTP (email) settings
- echo -e "\n===[SMTP (Email) Settings]==="
- echo "If host name is left blank, the password reset feature will be disabled."
- echo "Enter your email server's host address."
- read -e -p "> " SMTP_HOST
-
- if [ -n "$SMTP_HOST" ]; then # Prompt for additional SMTP details and then update server/config.yaml if host was set
- echo "Enter the Port number for your SMTP server"; read -e -p "> " SMTP_PORT
- echo "Enter the UserName for your SMTP server"; read -e -p "> " SMTP_USER
- echo "Enter the Password for your SMTP server"; read -e -p -s "> " SMTP_PASS
- echo "Enter the 'From' address emails should show"; read -e -p "> " SMTP_FROM
- sed -i "s|host: |host: $SMTP_HOST|; \
- s|port: |port: $SMTP_PORT|; \
- s|user: |user: $SMTP_USER|; \
- s|pass: |pass: $SMTP_PASS|; \
- s|from: |from: $SMTP_FROM|" ./server/config.yaml
- else # Warn user that they should set a contact email if no smtp host is specified
- echo -e "${NOTICE} No SMTP host specified! It is strongly recommended you set a contact email"
- echo " in the next prompt for manual password reset requests."
- fi
-
- echo "Enter your server's primary contact email address."
- read -e -p "> " CONTACT_ADDR
- if [ -n "$CONTACT_ADDR" ]; then sed -i "s|contact_email: |contact_email: $CONTACT_ADDR |" ./server/config.yaml; fi
-}
-
-function set_env () {
- ############################################################################################################
- # Copy ./doc/example.env to ./.env, then prompt the user to set the basic config settings
- # https://github.com/rr-/szurubooru/blob/master/doc/INSTALL.md
- ############################################################################################################
- cp doc/example.env .env
- echo -e "\n===[Environmental Variables]==="
- echo "Enter your desired database username."; read -e -p "> " -i "szuru" DB_USER
- while true; do # Ensures the user sets a database password for security reasons.
- echo "Enter your desired database password. (Will not print to console)"; read -s -p "> " DB_PASS
- if [ -z $DB_PASS ]; then echo -e "\nERROR: You must set a password!"; else break; fi
- done
- echo ""
- echo "Enter the build info you'd like to display on the home screen."; read -e -p "> " -i "latest" BUILD_INFO
- echo "Enter the port # to expose the HTTP service to."
- echo "Set to 127.0.0.1:8080 if you wish to reverse proxy the docker's port."; read -e -p "> " -i "8080" PORT
- echo "Enter the URL base to run szurubooru under"; read -e -p "> " -i "/" BASE_URL
- echo "Enter the directory in which you wish to store image data."; read -e -p "> " -i "/var/local/szurubooru/data" MOUNT_DATA
- echo "Enter the directory in which you wish to store database files."; read -e -p "> " -i "/var/local/szurubooru/sql" MOUNT_SQL
- sed -i "s|POSTGRES_USER=szuru|POSTGRES_USER=$DB_USER|; \
- s|POSTGRES_PASSWORD=changeme|POSTGRES_PASSWORD=$DB_PASS|; \
- s|BUILD_INFO=latest|BUILD_INFO=$BUILD_INFO|; \
- s|PORT=8080|PORT=$PORT|; \
- s|BASE_URL=/|BASE_URL=$URL|; \
- s|MOUNT_DATA=/var/local/szurubooru/data|MOUNT_DATA=$MOUNT_DATA|; \
- s|MOUNT_SQL=/var/local/szurubooru/sql|MOUNT_SQL=$MOUNT_SQL|" .env
-}
-
-echo "Creating and setting up server configuration (server/config.yaml)..."
-server_config # Configuration via ./server/config.yaml
-
-echo -e "\nCreating and setting up environmental variables (.env)..."
-set_env # Configuration via ./.env
-
-echo -e "\nConfig is all done! Now pulling Docker containers..."
-docker-compose pull # Download containers
-
-echo "Starting SQL container..."
-docker-compose up -d sql # Start SQL first
-
-echo "Waiting 30s to ensure the database is ready for connection..."
-sleep 30 # Give the database time to become available
-
-echo "Starting Server and Client containers..."
-docker-compose up -d # Start remaining containers
-
-# Ensure files can be uploaded by setting ownership of the /data/ mount point
-puid=$(grep "PUID=" server/Dockerfile | sed "s/.*=//")
-guid=$(grep "PGID=" server/Dockerfile | sed "s/.*=//")
-mount=$(grep "MOUNT_DATA" .env | sed 's/MOUNT_DATA=//')
-echo "Performing a quick ownership change of $mount to make sure images can be submitted..."
-chown -R $puid:$guid "$mount"
-
-echo "All done! You should now be able to access Szurubooru using the port number you set."
-exit 0
diff --git a/docker-compose.test.yml b/docker-compose.test.yml
deleted file mode 100644
index 0444c69..0000000
--- a/docker-compose.test.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-services:
- test-server:
- build:
- context: ./server
- target: testing
- environment:
- POSTGRES_HOST: test-sql
- POSTGRES_USER: your_postgres_user
- POSTGRES_PASSWORD: your_postgres_password
- depends_on:
- - test-sql
- volumes:
- - "${MOUNT_DATA}:/data"
- - "./server/config.yaml:/opt/app/config.yaml"
-
- test-sql:
- image: postgres:11-alpine
- restart: unless-stopped
- environment:
- POSTGRES_USER: your_postgres_user
- POSTGRES_PASSWORD: your_postgres_password
- volumes:
- - "${MOUNT_SQL}:/var/lib/postgresql/data" \ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
deleted file mode 100644
index dc7ca69..0000000
--- a/docker-compose.yml
+++ /dev/null
@@ -1,52 +0,0 @@
-## Example Docker Compose configuration
-##
-## Use this as a template to set up docker compose, or as guide to set up other
-## orchestration services
-services:
-
- server:
- # image: szurubooru/server:latest
- build:
- context: ./server
- depends_on:
- - sql
- environment:
- ## These should be the names of the dependent containers listed below,
- ## or FQDNs/IP addresses if these services are running outside of Docker
- POSTGRES_HOST: sql
- ## Credentials for database:
- POSTGRES_USER:
- POSTGRES_PASSWORD:
- ## Commented Values are Default:
- #POSTGRES_DB: defaults to same as POSTGRES_USER
- #POSTGRES_PORT: 5432
- #LOG_SQL: 0 (1 for verbose SQL logs)
- THREADS:
- volumes:
- - "${MOUNT_DATA}:/data"
- - "./server/config.yaml:/opt/app/config.yaml"
-
- client:
- # image: szurubooru/client:latest
- build:
- context: ./client
- args:
- BUILD_INFO: dev build
- depends_on:
- - server
- environment:
- BACKEND_HOST: server
- BASE_URL:
- volumes:
- - "${MOUNT_DATA}:/data:ro"
- ports:
- - "${PORT}:80"
-
- sql:
- image: postgres:11-alpine
- restart: unless-stopped
- environment:
- POSTGRES_USER:
- POSTGRES_PASSWORD:
- volumes:
- - "${MOUNT_SQL}:/var/lib/postgresql/data"
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