feat(docker): introduce variable UID/GID

This commit is contained in:
Sefa Eyeoglu 2022-02-25 23:07:29 +01:00
parent e81830b790
commit bab6bab12a
No known key found for this signature in database
GPG Key ID: C10411294912A422
3 changed files with 26 additions and 3 deletions

View File

@ -1,4 +1,6 @@
FROM python:3.10.2-bullseye
ARG UID=1337
ARG GID=1337
RUN pip install cachecontrol iso8601 requests lockfile jsonobject six \
&& apt-get update && apt-get install -y rsync cron
@ -12,10 +14,12 @@ RUN chmod 644 /etc/cron.d/meta-update \
COPY docker/entrypoint.sh /usr/local/bin/entrypoint
RUN chmod +x /usr/local/bin/entrypoint
RUN useradd -Um user \
RUN groupadd -g $GID user \
&& useradd -m -g $GID -u $UID user \
&& mkdir -p /home/user/.ssh \
&& ssh-keyscan github.com > /home/user/.ssh/known_hosts \
&& mkdir -p /app
&& mkdir -p /app \
&& chown -R $UID:$GID /app /home/user/.ssh
COPY . /app/

View File

@ -5,7 +5,7 @@ Scripts to generate jsons and jars that PolyMC will access.
It is recommended to use Docker to deploy the environment.
- Clone this repo to a server
- Make sure it's writable by the container later: `chown -R 1000:1000 .`
- Make sure it's writable by the container later: `chown -R 1337:1337 .`
- Configure `config/config_local.sh`
- The defaults should be fine (apart from committer email and name perhaps)
- Put your SSH key (which has push access to meta-upstream and meta-polymc) at `config/deploy.key`
@ -16,6 +16,9 @@ It is recommended to use Docker to deploy the environment.
- Observe Cron logs using `docker-compose logs -f` (Runs hourly by default)
- (Optional) Run once to fill caches: `docker-compose run meta update`
For local development you can also use `docker-compose.local.yaml`. By default it uses `UID=1000` and `GID=1000`.
Make sure it's the same as your host instance.
## Usage
### Install the dependencies

16
docker-compose.local.yaml Normal file
View File

@ -0,0 +1,16 @@
version: "3"
services:
meta:
build:
context: .
args:
UID: 1000
GID: 1000
command: update
volumes:
- "./caches:/app/caches"
- "./upstream:/app/upstream"
- "./polymc:/app/polymc"
- "./public:/app/public"
- "./config:/app/config"