-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use entrypoint to chown static folder to freva user.
- Loading branch information
1 parent
b5bf40c
commit 9ec8f64
Showing
2 changed files
with
19 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
ARG CONDA_ENV_DIR=/opt/condaenv | ||
ARG FREVA_WEB_DIR=/opt/freva_web | ||
ARG VERSION | ||
|
||
FROM condaforge/mambaforge | ||
LABEL org.opencontainers.image.authors="DRKZ-CLINT" | ||
LABEL org.opencontainers.image.source="https://github.com/FREVA-CLINT/freva-web" | ||
LABEL org.opencontainers.image.version="$VERSION" | ||
ARG CONDA_ENV_DIR | ||
ARG FREVA_WEB_DIR | ||
|
||
RUN set -e && \ | ||
groupadd -r -g 1000 freva && \ | ||
adduser --uid 1000 --gid 1000 --gecos "Freva user" \ | ||
--shell /bin/bash --disabled-password freva --home ${FREVA_WEB_DIR} &&\ | ||
mkdir -p ${CONDA_ENV_DIR} && chown -R freva:freva $CONDA_ENV_DIR | ||
WORKDIR ${FREVA_WEB_DIR} | ||
--shell /bin/bash --disabled-password freva --home /opt/freva_web &&\ | ||
mkdir -p /opt/condaenv && chown -R freva:freva /opt/condaenv | ||
WORKDIR /opt/freva_web | ||
COPY . . | ||
ENV PATH=$CONDA_ENV_DIR/bin:$PATH\ | ||
ENV PATH=/opt/condaenv/bin:$PATH\ | ||
DJANGO_SUPERUSER_EMAIL=freva@dkrz.de | ||
RUN set -e && \ | ||
mamba env create -y -p ${CONDA_ENV_DIR} -f conda-env.yml &&\ | ||
mamba env create -y -p /opt/condaenv -f conda-env.yml &&\ | ||
mamba clean -afy &&\ | ||
npm install && npm run build-production &&\ | ||
rm -rf node_modules &&\ | ||
echo "export PATH=${PATH}" >> ${FREVA_WEB_DIR}/.bashrc &&\ | ||
mkdir -p ${FREVA_WEB_DIR}/static &&\ | ||
chown -R freva:freva ${FREVA_WEB_DIR} | ||
ENTRYPOINT ["/bin/sh", "entrypoint.sh"] | ||
VOLUME ${FREVA_WEB_DIR}/static | ||
echo "export PATH=${PATH}" >> /opt/freva_web/.bashrc &&\ | ||
mkdir -p /opt/freva_web/static &&\ | ||
mv entrypoint.sh /usr/local/bin/ &&\ | ||
chmod +x /usr/local/bin/entrypoint.sh &&\ | ||
chown -R freva:freva /opt/freva_web | ||
ENTRYPOINT /usr/local/bin/entrypoint.sh | ||
VOLUME /opt/freva_web/static | ||
EXPOSE 8000 | ||
CMD ./init_django.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
chown -R freva:freva ${FREVA_WEB_DIR}/static | ||
exec runuser -u freva "$@" | ||
chown -R freva:freva /opt/freva_web/static | ||
if [ "$@" ];then | ||
runuser -u freva -- $@ | ||
else | ||
runuser -u freva -- /opt/freva_web/init_django.sh | ||
fi |