From 3abac37ba428e72604d4a0bc283ff0372410d6e6 Mon Sep 17 00:00:00 2001 From: Aitzol Date: Thu, 20 Apr 2023 11:55:17 +0200 Subject: [PATCH] docker --- Dockerfile | 13 ++++--------- README.md | 6 +++++- start.sh | 10 ++++++++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index cf06f6f..4c44ee4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,11 @@ FROM python:3-alpine - +ARG UID_ +ENV UID_=1000 RUN apk add --no-cache --upgrade bash -RUN mkdir -p /www -RUN chown -R 1000:1000 /www + +ADD --chown=$UID_:$UID_ . /www WORKDIR /www -COPY . . -#COPY --chown=1000:1000 . . -#COPY --chown=daemon:daemon settings.ini.example settings.ini -RUN cp settings.ini.example settings.ini RUN chmod +x start.sh RUN set -e; \ apk add --no-cache --virtual .build-deps \ @@ -19,6 +16,4 @@ RUN set -e; \ pip install -r requirements.txt; \ apk del .build-deps; -#EXPOSE 9090 -USER 1000 ENTRYPOINT ["./start.sh"] diff --git a/README.md b/README.md index 5416d6b..2f537fc 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,11 @@ Biltegi honetako edukiak klonatu eta menpekotasunak instalatu: #### Docker irudia sortu docker build -t aitzol/ldap-webui:latest . - + +edo + + docker build -t aitzol/ldap-webui:latest . --build-arg UID_=$UID + #### Edukiontzia sortu docker-compose up -d diff --git a/start.sh b/start.sh index 3aa4db0..896f098 100755 --- a/start.sh +++ b/start.sh @@ -1,5 +1,11 @@ #!/bin/bash -if [ ! -f /tmp/foo.txt ]; then +if [ ! -f settings.ini ]; then cp settings.ini.example settings.ini fi -uwsgi --http :9090 --enable-threads --uid 1000 --wsgi-file app.py + +if [[ $# -gt 0 ]]; then + UID_=$1 + echo $UID_ +fi + +uwsgi --http :9090 --enable-threads --uid $UID_ --wsgi-file app.py