Browse Source

chore: remove ability to define custom UID/GID at container creation

master
Michael Serajnik 1 year ago
parent
commit
96ddca1cce
No known key found for this signature in database GPG Key ID: B390A5CBA3ECB74D
  1. 5
      CHANGELOG.md
  2. 32
      Dockerfile
  3. 26
      README.md
  4. 0
      docker-cmd-start.sh
  5. 10
      docker-entrypoint.sh

5
CHANGELOG.md

@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Removed
+ Removed the ability to define custom UID and GID for the Docker container at
container creation due to several issues arising from that
## [3.22.0] - 2020-01-05
### Added

32
Dockerfile

@ -1,16 +1,18 @@
FROM python:3.8-slim-buster
ARG USER_ID=1000
ARG GROUP_ID=1000
ENV \
USER_ID=$USER_ID \
GROUP_ID=$GROUP_ID
WORKDIR /usr/src/app
COPY ./hydrus .
COPY ./deb .
RUN \
chmod +x \
server.py \
bin/swfrender_linux \
bin/upnpc_linux && \
mkdir /data && \
apt-get update && apt-get install --no-install-recommends -y \
build-essential \
ffmpeg \
@ -41,13 +43,16 @@ RUN \
rm -r ~/.cache && \
apt-get remove build-essential --purge -y && \
apt-get clean && apt-get autoremove --purge -y && \
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/* && \
chown -R ${USER_ID}:${GROUP_ID} /usr/src/app && \
chmod +x \
server.py \
bin/swfrender_linux \
bin/upnpc_linux && \
mkdir /data && chown -R ${USER_ID}:${GROUP_ID} /data
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint
COPY docker-start.sh /usr/local/bin/docker-start
RUN \
chmod +x /usr/local/bin/docker-entrypoint && \
chmod +x /usr/local/bin/docker-start
COPY docker-cmd-start.sh /usr/local/bin/start
RUN chmod +x /usr/local/bin/start
EXPOSE 45870/tcp 45871/tcp 45872/tcp
@ -57,5 +62,6 @@ HEALTHCHECK --interval=1m --timeout=10s --retries=3 \
VOLUME /data
ENTRYPOINT ["docker-entrypoint"]
CMD ["docker-start"]
USER ${USER_ID}:${GROUP_ID}
CMD ["start"]

26
README.md

@ -17,7 +17,6 @@ The latest build runs [hydrus server version 379][hydrus-server-version].
+ [Usage](#usage)
+ [Ports](#ports)
+ [Storage](#storage)
+ [UID/GID](#uidgid)
+ [Donate](#donate)
+ [Maintainer](#maintainer)
+ [Contribute](#contribute)
@ -38,9 +37,7 @@ specific version of hydrus server, provide the version number as tag, e.g.:
[email protected]:~$ docker pull mserajnik/hydrus-server-docker:379
```
See [here][docker-hub-tags] for all the available version numbers/tags.
Alternatively, you can clone this repository and build the image yourself:
Alternatively, you can also build the image yourself:
```zsh
[email protected]:~$ git clone --recurse-submodules https://github.com/mserajnik/hydrus-server-docker.git
@ -48,6 +45,10 @@ [email protected]:~$ cd hydrus-server-docker
[email protected]:hydrus-server-docker$ docker build . -t hydrus-server-docker
```
The user that is used inside the container has UID `1000` and GID `1000` by
default. You can adjust this (e.g., to match your host UID/GID) by providing
the arguments `USER_ID` and `GROUP_ID` when making a build.
### Dependencies
+ [Docker][docker]
@ -118,22 +119,11 @@ mount that over it:
[email protected]:~$ docker volume create hydrus-server-data
```
### UID/GID
The user that owns the data and runs the server inside the container has the
UID `1000` and the GID `1000` by default. You can change these by providing the
environment variables `CUSTOM_UID` and `CUSTOM_GID` when creating a container.
This is useful if you want to access the data outside the container with a user
with different IDs without hassle. In such a case, `CUSTOM_UID` and
`CUSTOM_GID` should match the user that is going to access the data on the
host.
Here is a full example for running the container with all the options mentioned
above:
After creating your named volume, you can run the container. Here is a full
example with all the options mentioned above:
```zsh
[email protected]:~$ docker run -p 45870:45870 -p 45871:45871 -p 45872:45872 -v hydrus-server-data:/data -e CUSTOM_UID=1000 -e CUSTOM_GID=1000 -d mserajnik/hydrus-server-docker
[email protected]:~$ docker run -p 45870:45870 -p 45871:45871 -p 45872:45872 -v hydrus-server-data:/data -d mserajnik/hydrus-server-docker
```
Specifying the same named volume every time a container is created gives each

0
docker-start.sh → docker-cmd-start.sh

10
docker-entrypoint.sh

@ -1,10 +0,0 @@
#!/bin/bash
USER_ID=${CUSTOM_UID:-1000}
GROUP_ID=${CUSTOM_GID:-1000}
echo "Setting permissions to UID/GID ${USER_ID}/${GROUP_ID}."
chown ${USER_ID}:${GROUP_ID} -R /usr/src/app
chown ${USER_ID}:${GROUP_ID} -R /data
exec gosu ${USER_ID}:${GROUP_ID} "[email protected]"
Loading…
Cancel
Save