mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 12:30:15 +02:00
Optimize Dockerfile
This commit is contained in:
parent
179c26975c
commit
04f3473ef3
@ -9,21 +9,21 @@ ENV AUTH_HOME=/home/allianceauth
|
|||||||
|
|
||||||
# Setup user and directory permissions
|
# Setup user and directory permissions
|
||||||
SHELL ["/bin/bash", "-c"]
|
SHELL ["/bin/bash", "-c"]
|
||||||
RUN groupadd -g 61000 ${AUTH_GROUP}
|
RUN groupadd -g 61000 ${AUTH_GROUP} && \
|
||||||
RUN useradd -g 61000 -l -M -s /bin/false -u 61000 ${AUTH_USER}
|
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}
|
|
||||||
|
|
||||||
# Install build dependencies
|
RUN mkdir -p ${STATIC_BASE}/myauth/static \
|
||||||
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
|
&& chown ${AUTH_USERGROUP} ${STATIC_BASE}/myauth/static
|
||||||
libmariadb-dev gcc git pkg-config
|
|
||||||
|
|
||||||
# Install python dependencies
|
# Install Build Dependencies
|
||||||
RUN pip install --upgrade pip
|
RUN apt-get update \
|
||||||
RUN pip install wheel gunicorn
|
&& apt-get upgrade -y \
|
||||||
RUN pip install ${AUTH_PACKAGE}
|
&& 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
|
# Switch to non-root user
|
||||||
USER ${AUTH_USER}
|
USER ${AUTH_USER}
|
||||||
@ -33,7 +33,6 @@ WORKDIR ${AUTH_HOME}
|
|||||||
RUN allianceauth start myauth
|
RUN allianceauth start myauth
|
||||||
COPY /allianceauth/project_template/project_name/settings/local.py ${AUTH_HOME}/myauth/myauth/settings/local.py
|
COPY /allianceauth/project_template/project_name/settings/local.py ${AUTH_HOME}/myauth/myauth/settings/local.py
|
||||||
RUN allianceauth update myauth
|
RUN allianceauth update myauth
|
||||||
RUN mkdir -p ${STATIC_BASE}/myauth/static
|
|
||||||
|
|
||||||
RUN echo 'alias auth="python $AUTH_HOME/myauth/manage.py"' >> ~/.bashrc && \
|
RUN echo 'alias auth="python $AUTH_HOME/myauth/manage.py"' >> ~/.bashrc && \
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
ARG AA_DOCKER_TAG
|
ARG AA_DOCKER_TAG
|
||||||
FROM $AA_DOCKER_TAG
|
FROM $AA_DOCKER_TAG
|
||||||
|
|
||||||
RUN cd /home/allianceauth
|
WORKDIR ${AUTH_HOME}
|
||||||
|
|
||||||
COPY /conf/requirements.txt requirements.txt
|
COPY /conf/requirements.txt requirements.txt
|
||||||
RUN pip install -r requirements.txt
|
RUN --mount=type=cache,target=~/.cache \
|
||||||
|
pip install -r requirements.txt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user