diff --git a/docker/Dockerfile b/docker/Dockerfile index 8ae60b06..e9d6fbb1 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,21 +9,21 @@ ENV AUTH_HOME=/home/allianceauth # Setup user and directory permissions SHELL ["/bin/bash", "-c"] -RUN groupadd -g 61000 ${AUTH_GROUP} -RUN useradd -g 61000 -l -M -s /bin/false -u 61000 ${AUTH_USER} -RUN mkdir -p ${STATIC_BASE} \ - && chown ${AUTH_USERGROUP} ${STATIC_BASE} \ - && mkdir -p ${AUTH_HOME} \ - && chown ${AUTH_USERGROUP} ${AUTH_HOME} +RUN groupadd -g 61000 ${AUTH_GROUP} && \ + useradd -g 61000 -l -m -s /bin/false -u 61000 ${AUTH_USER} -# Install build dependencies -RUN apt-get update && apt-get upgrade -y && apt-get install -y \ - libmariadb-dev gcc git pkg-config +RUN mkdir -p ${STATIC_BASE}/myauth/static \ + && chown ${AUTH_USERGROUP} ${STATIC_BASE}/myauth/static -# Install python dependencies -RUN pip install --upgrade pip -RUN pip install wheel gunicorn -RUN pip install ${AUTH_PACKAGE} +# Install Build Dependencies +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get install -y --no-install-recommends libmariadb-dev gcc git pkg-config \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Install AA and Dependencies +RUN pip install --no-cache-dir ${AUTH_PACKAGE} gunicorn # Switch to non-root user USER ${AUTH_USER} @@ -33,7 +33,6 @@ WORKDIR ${AUTH_HOME} RUN allianceauth start myauth COPY /allianceauth/project_template/project_name/settings/local.py ${AUTH_HOME}/myauth/myauth/settings/local.py RUN allianceauth update myauth -RUN mkdir -p ${STATIC_BASE}/myauth/static RUN echo 'alias auth="python $AUTH_HOME/myauth/manage.py"' >> ~/.bashrc && \ source ~/.bashrc diff --git a/docker/custom.dockerfile b/docker/custom.dockerfile index 99d11d1b..458ff724 100644 --- a/docker/custom.dockerfile +++ b/docker/custom.dockerfile @@ -1,6 +1,8 @@ ARG AA_DOCKER_TAG FROM $AA_DOCKER_TAG -RUN cd /home/allianceauth +WORKDIR ${AUTH_HOME} + COPY /conf/requirements.txt requirements.txt -RUN pip install -r requirements.txt +RUN --mount=type=cache,target=~/.cache \ + pip install -r requirements.txt