Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft version of ubi9 image #59

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Dockerfile.ubi9
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM registry.access.redhat.com/ubi9/php-81

# Install dependencies
USER root
RUN dnf remove --disableplugin subscription-manager --disableplugin product-id -y subscription-manager && \
dnf install -y cronie && \
dnf clean all && \
chown default:root /var/run && setcap "cap_setuid=ep cap_setgid=ep" /usr/sbin/crond && \
sed -i 's/\(account required pam_unix.so\)/\1 broken_shadow/g' /etc/pam.d/system-auth

# Reset to default application user
USER default

# Define Grav version
ARG GRAV_VERSION=latest

# Unpack Grav
WORKDIR /tmp
RUN curl -o grav-admin.zip -fL --no-progress-meter https://getgrav.org/download/core/grav-admin/${GRAV_VERSION} && \
unzip grav-admin.zip && \
mv grav-admin/* grav-admin/.[!.]* /opt/app-root/src/ && \
rm -rf grav-admin*

# Reset working directory back to s2i default
WORKDIR /opt/app-root/src

#######
# Here you can do pre-configuration of the image if needed.
#######
# For example, install Grav plugins or themes
#
#RUN bin/gpm direct-install -y https://getgrav.org/download/plugins/anchors/1.6.0 && \
# bin/gpm direct-install -y https://getgrav.org/download/plugins/external_links/1.6.3

# Or run needed scripts to pre-create things
#RUN bin/plugin tntsearch index

# Or do customizations via patches
#RUN --mount=type=bind,source=patches/,target=/tmp/patches \
# patch -p1 -d user/plugins/tntsearch < /tmp/patches/tntsearch.patch

# Or just overwrite full files with your own copy
#COPY --chown=default:root pages/ ./user/pages
#######

# Create cron job for Grav maintenance scripts
RUN (crontab -l; echo "* * * * * cd /opt/app-root/src;/usr/bin/php bin/grav scheduler 1>> /dev/null 2>&1") | crontab -
COPY --chown=default:root php-pre-start/ ./php-pre-start

# Provide a volume inside image for data persistence
VOLUME ["/opt/app-root/src"]

CMD /usr/libexec/s2i/run
3 changes: 3 additions & 0 deletions php-pre-start/run-cron.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

crond