1
0
Fork 0
mirror of https://github.com/imtbl/hydrus-server-docker synced 2024-05-17 11:03:20 +12:00

feat: Update Docker setup

This commit is contained in:
Michael Serajnik 2019-01-19 14:51:48 +01:00
parent 74e3f70ea7
commit d8f29f21cc
No known key found for this signature in database
GPG key ID: B390A5CBA3ECB74D
4 changed files with 80 additions and 31 deletions

View file

@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Changed
+ Updated hydrus server version
+ Updated setup to run hydrus server from source (instead of the pre-compiled
executable)
+ Switched base image to Alpine (instead of Debian)
## [1.4.1] - 2019-01-13
### Fixed

View file

@ -1,4 +1,4 @@
FROM debian:stretch-slim
FROM python:3.7-alpine
ARG HOST_USER_ID=1000
ARG HOST_GROUP_ID=1000
@ -8,24 +8,56 @@ ENV HOST_GROUP_ID=$HOST_GROUP_ID
RUN \
if [ $(getent group ${HOST_GROUP_ID}) ]; then \
useradd -r -u ${HOST_USER_ID} hydrus; \
adduser -D -u ${HOST_USER_ID} hydrus; \
else \
groupadd -g ${HOST_GROUP_ID} hydrus && \
useradd -r -u ${HOST_USER_ID} -g hydrus hydrus; \
addgroup -g ${HOST_GROUP_ID} hydrus && \
adduser -D -u ${HOST_USER_ID} -G hydrus hydrus; \
fi
WORKDIR /usr/src/app
RUN apt-get update && \
apt-get install -y ca-certificates ffmpeg wget --no-install-recommends && \
rm -rf /var/lib/apt/lists/* && \
wget "https://github.com/hydrusnetwork/hydrus/releases/download/v334/Hydrus.Network.334.-.Linux.-.Executable.tar.gz" && \
tar zxvf $(ls | grep "Linux.-.Executable.tar.gz") --strip-components 1 && \
rm $(ls | grep "Linux.-.Executable.tar.gz") && \
RUN \
wget "https://github.com/hydrusnetwork/hydrus/archive/v336.tar.gz" && \
tar zxvf $(ls | grep ".tar.gz") --strip-components 1 && \
rm $(ls | grep ".tar.gz") && \
sed -i '/from include import HydrusPy2To3/d' ./server.py && \
sed -i '/HydrusPy2To3.do_2to3_test()/d' ./server.py && \
chown -R hydrus:hydrus /usr/src/app && \
chmod +x server.py && \
chmod +x bin/swfrender_linux bin/upnpc_linux && \
rm \
bin/swfrender_osx \
bin/swfrender_win32.exe \
bin/upnpc_osx \
bin/upnpc_win32.exe && \
mkdir /data && chown -R hydrus:hydrus /data && \
apt-get remove ca-certificates wget -y && \
apt-get autoremove -y
apk --no-cache add \
build-base \
ffmpeg \
jpeg-dev \
libffi-dev \
linux-headers \
openssl \
openssl-dev && \
pip install virtualenv && \
virtualenv venv && \
source venv/bin/activate && \
pip install \
beautifulsoup4~=4.7.1 \
lz4~=2.1.6 \
numpy~=1.16.0 \
pillow~=5.4.1 \
psutil~=5.4.8 \
pycryptodome~=3.7.3 \
pylzma~=0.5.0 \
pyopenssl~=18.0.0 \
pyyaml~=3.13 \
requests~=2.21.0 \
send2trash~=1.5.0 \
service_identity~=18.1.0 \
twisted~=18.9.0 && \
rm -r ~/.cache && \
apk del build-base jpeg-dev libffi-dev linux-headers openssl-dev
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint

View file

@ -1,23 +1,23 @@
# hydrus-server-docker [![hydrus server version][hydrus-server-badge]][hydrus-server-version] [![Build status][travis-badge]][travis] [![Docker Hub build][docker-hub-badge]][docker-hub]
> Compiled version of [hydrus server][hydrus-server] running on Debian
> [hydrus server][hydrus-server] running on Alpine
This is a simple Debian-based Docker setup for running the compiled version of
[hydrus server][hydrus-server]. It was mainly created for making it easier to
run hydrus server together with [hydrusrv][hydrusrv], but can of course also be
used on its own.
This is a simple Alpine-based Docker setup for running
[hydrus server][hydrus-server] from source. It was mainly created for making it
easier to run hydrus server together with [hydrusrv][hydrusrv], but can of
course also be used on its own.
The latest build runs [hydrus server version 334][hydrus-server-version].
The latest build runs [hydrus server version 336][hydrus-server-version].
## Table of contents
+ [Install](#install)
+ [Dependencies](#dependencies)
+ [Updating](#updating)
+ [Upgrading from 1.x to 2.x](#upgrading-from-1x-to-2x)
+ [Usage](#usage)
+ [Additional configuration when building](#additional-configuration-when-building)
+ [UID/GID](#uidgid)
+ [Caveats](#caveats)
+ [Donate](#donate)
+ [Maintainer](#maintainer)
+ [Contribute](#contribute)
@ -35,7 +35,7 @@ By default, this will pull the latest build. To specify an image with a
specific version of hydrus server, provide the version number as tag, e.g.:
```zsh
user@local:~$ docker pull mserajnik/hydrus-server-docker:334
user@local:~$ docker pull mserajnik/hydrus-server-docker:336
```
See [here][docker-hub-tags] for all the available version numbers/tags.
@ -55,7 +55,7 @@ user@local:hydrus-server-docker$ docker build . -t hydrus-server-docker
### Updating
If you have installed via Docker Hub, just pull the updated image. Otherwise,
just pull from this repository and make a new build.
pull from this repository and make a new build.
This repository follows [semantic versioning][semantic-versioning] and any
breaking changes that require additional attention will be released under a new
@ -65,6 +65,19 @@ are therefore always safe to simply install via the routine mentioned before.
When necessary, this section will be expanded with upgrade guides to new major
versions.
#### Upgrading from 1.x to 2.x
Upgrading from `1.x` to `2.x` can be done via pulling the updated image from
Docker Hub or building it yourself and requires no further manual changes.
Since there have been issues with running the pre-compiled version of hydrus
server 335+ (which made the switch to Python 3) on the previous Docker setup,
starting with `2.0.0`, the Docker image is now based on Alpine (instead of
Debian) and runs hydrus server from source.
This approximately halves the resulting image size while at the same time
making it easier to adapt for future changes/dependencies.
## Usage
First, you need to bind the exposed ports. This can be done automatically
@ -112,11 +125,6 @@ with different ID's without hassle. In such a case, `HOST_USER_ID` and
`HOST_GROUP_ID` should match the user that is going to access the data on the
host.
## Caveats
+ The image also includes the hydrus client due to the compiled releases always
including both it and the server. This adds quite a bit of size to the image.
## Donate
If you like hydrus-server-docker and want to buy me a coffee, feel free to
@ -147,13 +155,13 @@ You are welcome to help out!
[hydrus-server]: http://hydrusnetwork.github.io/hydrus/
[hydrusrv]: https://github.com/mserajnik/hydrusrv
[hydrus-server-version]: https://github.com/hydrusnetwork/hydrus/releases/tag/v334
[hydrus-server-version]: https://github.com/hydrusnetwork/hydrus/releases/tag/v336
[docker-hub]: https://hub.docker.com/r/mserajnik/hydrus-server-docker/
[docker-hub-tags]: https://hub.docker.com/r/mserajnik/hydrus-server-docker/tags/
[docker]: https://www.docker.com/
[semantic-versioning]: https://semver.org/
[hydrus-server-badge]: https://img.shields.io/badge/hydrus%20server-version%20334-blue.svg
[hydrus-server-badge]: https://img.shields.io/badge/hydrus%20server-version%20336-blue.svg
[travis]: https://travis-ci.com/mserajnik/hydrus-server-docker
[travis-badge]: https://travis-ci.com/mserajnik/hydrus-server-docker.svg

View file

@ -1,11 +1,13 @@
#!/bin/bash
#!/bin/sh
source venv/bin/activate
stop() {
./server stop -d="/data"
./server.py stop -d="/data"
}
trap "stop" SIGTERM
./server -d="/data" &
./server.py -d="/data" &
wait $!