Allow to set password

This commit is contained in:
Ramon Bartl 2022-02-10 09:56:29 +01:00
parent d9b7e92048
commit 184faac528
No known key found for this signature in database
GPG key ID: 359669D35BDDF79B
4 changed files with 44 additions and 37 deletions

View file

@ -24,49 +24,41 @@ RUN useradd --system -m -d $SENAITE_HOME -U -u 500 $SENAITE_USER
# Create directories # Create directories
RUN mkdir -p $SENAITE_INSTANCE_HOME $SENAITE_FILESTORAGE $SENAITE_BLOBSTORAGE RUN mkdir -p $SENAITE_INSTANCE_HOME $SENAITE_FILESTORAGE $SENAITE_BLOBSTORAGE
# Copy the build dependencies # Copy Buildout
COPY build_deps.txt / COPY requirements.txt buildout.cfg $SENAITE_INSTANCE_HOME
# Copy the runtime dependencies # Copy the build dependencies and startup scripts
COPY run_deps.txt / COPY build_deps.txt run_deps.txt docker-initialize.py docker-entrypoint.sh /
# Install package dependencies # Note: we concatenate all commands to avoid multiple layer generation and reduce the image size
RUN apt-get update RUN apt-get update \
RUN apt-get install -y --no-install-recommends $(grep -vE "^\s*#" /build_deps.txt | tr "\n" " ") # Install system packages
RUN apt-get install -y --no-install-recommends $(grep -vE "^\s*#" /run_deps.txt | tr "\n" " ") && apt-get install -y --no-install-recommends $(grep -vE "^\s*#" /build_deps.txt | tr "\n" " ") \
&& apt-get install -y --no-install-recommends $(grep -vE "^\s*#" /run_deps.txt | tr "\n" " ") \
# Fetch unified installer # Fetch unified installer
RUN wget -O Plone.tgz https://launchpad.net/plone/$PLONE_MAJOR/$PLONE_VERSION/+download/$PLONE_UNIFIED_INSTALLER.tgz \ && wget -O Plone.tgz https://launchpad.net/plone/$PLONE_MAJOR/$PLONE_VERSION/+download/$PLONE_UNIFIED_INSTALLER.tgz \
&& echo "$PLONE_MD5 Plone.tgz" | md5sum -c - \ && echo "$PLONE_MD5 Plone.tgz" | md5sum -c - \
&& tar -xzf Plone.tgz \ && tar -xzf /Plone.tgz \
&& cp -rv /$PLONE_UNIFIED_INSTALLER/base_skeleton/* $SENAITE_INSTANCE_HOME \ && cp -rv $PLONE_UNIFIED_INSTALLER/base_skeleton/* $SENAITE_INSTANCE_HOME \
&& cp -v /$PLONE_UNIFIED_INSTALLER/buildout_templates/buildout.cfg $SENAITE_INSTANCE_HOME/buildout-base.cfg \ && cp -v $PLONE_UNIFIED_INSTALLER/buildout_templates/buildout.cfg $SENAITE_INSTANCE_HOME/buildout-base.cfg \
&& cd $SENAITE_HOME \ && rm -rf $PLONE_UNIFIED_INSTALLER Plone.tgz \
&& rm -rf /$PLONE_UNIFIED_INSTALLER /Plone.tgz # Buildout
&& cd $SENAITE_INSTANCE_HOME \
&& pip install -r requirements.txt \
&& buildout \
&& ln -s $SENAITE_FILESTORAGE/ var/filestorage \
&& ln -s $SENAITE_BLOBSTORAGE/ var/blobstorage \
&& chown -R senaite:senaite $SENAITE_HOME $SENAITE_DATA \
# Cleanup
&& apt-get purge -y --auto-remove $(grep -vE "^\s*#" /build_deps.txt | tr "\n" " ") \
&& rm -rf /$SENAITE_HOME/buildout-cache \
&& rm -rf /var/lib/apt/lists/*
# Change working directory # Change working directory
WORKDIR $SENAITE_INSTANCE_HOME WORKDIR $SENAITE_INSTANCE_HOME
# Copy Buildout
COPY requirements.txt buildout.cfg ./
# Buildout
RUN pip install -r requirements.txt \
&& buildout \
&& ln -s $SENAITE_FILESTORAGE/ var/filestorage \
&& ln -s $SENAITE_BLOBSTORAGE/ var/blobstorage \
&& chown -R senaite:senaite $SENAITE_HOME $SENAITE_DATA
# Cleanup
RUN apt-get purge -y --auto-remove $(grep -vE "^\s*#" /build_deps.txt | tr "\n" " ")
RUN rm -rf /$SENAITE_HOME/buildout-cache
RUN rm -rf /var/lib/apt/lists/*
# Mount external volume # Mount external volume
# VOLUME /data VOLUME /data
# Copy startup scripts
COPY docker-initialize.py docker-entrypoint.sh /
# Expose instance port # Expose instance port
EXPOSE 8080 EXPOSE 8080

View file

@ -1,7 +1,7 @@
# Note: Changing the latest PR will force a new buildout run and therefore, a # Note: Changing the latest PR will force a new buildout run and therefore, a
# new git checkout of the senaite sources! # new git checkout of the senaite sources!
# #
# Latest `senaite.core` PR: #1928 # Latest `senaite.core` PR: #1933
[buildout] [buildout]
index = https://pypi.python.org/simple/ index = https://pypi.python.org/simple/
extends = extends =
@ -20,7 +20,8 @@ download-cache=../buildout-cache/downloads
parts += parts +=
zeo zeo
plonesite plonesite
client_reserved
console_scripts
eggs += eggs +=
senaite.lims senaite.lims
@ -54,6 +55,14 @@ event-log-args = (sys.stderr,)
access-log-handler = StreamHandler access-log-handler = StreamHandler
access-log-args = (sys.stdout,) access-log-args = (sys.stdout,)
[client_reserved]
<= instance_base
recipe = plone.recipe.zope2instance
http-address = 8089
[console_scripts]
recipe = zc.recipe.egg:scripts
eggs = senaite.core
[plonesite] [plonesite]
recipe = collective.recipe.plonesite recipe = collective.recipe.plonesite

View file

@ -25,6 +25,11 @@ if [[ "$1" == "zeo"* ]]; then
exec gosu senaite bin/$1 fg exec gosu senaite bin/$1 fg
fi fi
# Change the password
if [[ -n "${PASSWORD}" ]]; then
gosu senaite bin/zope-passwd -p "${PASSWORD}"
fi
# Instance start # Instance start
if [[ $START == *"$1"* ]]; then if [[ $START == *"$1"* ]]; then
exec gosu senaite bin/instance console exec gosu senaite bin/instance console

View file

@ -11,3 +11,4 @@ libxml2
libxslt1.1 libxslt1.1
lynx lynx
rsync rsync
vim