Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ClubCedille/cedille-dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-Boyer committed Oct 16, 2024
2 parents 77bf260 + 8f293cf commit f17ad05
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- init-grav
- vault
- terraform-agent
- mongo
tag:
required: true
description: Version a tag l'image
Expand Down
7 changes: 4 additions & 3 deletions grav/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.2.12-apache-bullseye
FROM php:8.3.6-apache-bullseye
LABEL maintainer="Andy Miller <rhuk@getgrav.org> (@rhukster)"


Expand Down Expand Up @@ -45,6 +45,7 @@ RUN { \
echo 'upload_max_filesize=128M'; \
echo 'post_max_size=128M'; \
echo 'expose_php=off'; \
echo 'memory_limit=2048M'; \
} > /usr/local/etc/php/conf.d/php-recommended.ini

RUN pecl channel-update pecl.php.net
Expand All @@ -58,7 +59,7 @@ RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
RUN echo "Listen 8080" > /etc/apache2/ports.conf

# Define Grav specific version of Grav or use latest stable
ARG GRAV_VERSION=1.7.43
ARG GRAV_VERSION=1.7.45
ARG GRAV_SKELETON_URL=https://github.com/getgrav/grav/releases/download/$GRAV_VERSION/grav-admin-v$GRAV_VERSION.zip
ARG GRAV_SKELETON_FOLDER=grav-admin
#https://github.com/getgrav/grav-skeleton-gateway-site/releases/download/1.0.1/grav-skeleton-gateway-site+admin-1.0.1.zip
Expand Down Expand Up @@ -90,4 +91,4 @@ VOLUME ["/var/www/html"]

ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]
# CMD ["apache2-foreground"]
# CMD ["sh", "/entrypoint.sh"]pache2-foregroun
# CMD ["sh", "/entrypoint.sh"]pache2-foregroun
15 changes: 11 additions & 4 deletions grav/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ ln -s "/vault/secrets/$GIT_VAULT_SECRET" "/var/www/html/user/config/plugins/git-
bin/plugin git-sync init
bin/plugin git-sync sync > /dev/null
cd /var/www/html/user
git pull origin $HEAD_BRANCH
git fetch origin
git reset --hard origin/master
echo "done"

echo "Creating admin user..."
cp "/vault/secrets/$ADMIN_VAULT_SECRET" /var/www/html/user/accounts/admin.yaml
if [ ! -f "/var/www/html/user/accounts/admin.yaml" ]; then
echo "Creating admin user..."
cp "/vault/secrets/$ADMIN_VAULT_SECRET" /var/www/html/user/accounts/admin.yaml
echo done
fi

echo "Creating sre user..."
cp "/vault/secrets/$SRE_VAULT_SECRET" /var/www/html/user/accounts/sre.yaml
echo done

rm /var/www/html/user/config/security.yaml
ln -s /vault/secrets/salt /var/www/html/user/config/security.yaml

apache2-foreground
apache2-foreground
31 changes: 18 additions & 13 deletions init-grav/init.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
#!/bin/sh
# copy-theme.sh
cd /var/www/

THEMES_DIR=/var/www/html/user/themes

echo " Copying theme..."
# GRAV_SKELETON_URL=https://github.com/getgrav/grav-skeleton-gateway-site/releases/download/1.0.1/grav-skeleton-gateway-site+admin-1.0.1.zip
# THEMES_DIR=/var/www/html/user/themes

# Create the themes directory if it does not exist
[ ! -d "$THEMES_DIR" ] && mkdir -p "$THEMES_DIR"

# Use rsync to copy the initial content
if [ -z "$(ls -A "$THEMES_DIR")" ]; then
rsync -av /initial-content/ /var/www/html/
# Change ownership of the copied content to www-data
chown -R 33:33 /var/www/html
# Install git-sync plugin
cd /var/www/html
echo " Copying theme..."
cd /var/www/html/
wget "$GRAV_SKELETON_URL" -O theme.zip
unzip theme.zip
rm theme.zip
git clone https://github.com/getgrav/grav.git grav
# Install git-sync plugin
bin/gpm install git-sync
# Configures git-sync plugin
# Configures git-sync plugin
ln -s /vault/secrets/grav /var/www/html/user/config/plugins/git-sync.yaml
else
echo "Themes directory is not empty. Skipping copying initial content."
fi

if [ -z "$(ls -A /var/www/html/user/.git)" ]; then
echo "git not initialized, running init script..."
echo "git not initialized, running init script..."
cd /var/www/html/
wget "$GRAV_SKELETON_URL" -O skeleton.zip
unzip skeleton.zip
# Install git-sync plugin
bin/gpm install git-sync
cd /var/www/html
rm /var/www/html/user/config/plugins/git-sync.yaml
ln -s "/vault/secrets/$GIT_VAULT_SECRET" "/var/www/html/user/config/plugins/git-sync.yaml"
git config --global --add safe.directory /var/www/html/user
Expand Down
7 changes: 7 additions & 0 deletions mongo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM mongo:6-jammy

ENV MONGO_INITDB_ROOT_USERNAME admin
ENV MONGO_INITDB_ROOT_PASSWORD secret
ENV MONGO_INITDB_DATABASE admin

ADD mongo-init.js /docker-entrypoint-initdb.d/
16 changes: 16 additions & 0 deletions mongo/mongo-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
db.auth(process.env.MONGO_INITDB_ROOT_USERNAME, process.env.MONGO_INITDB_ROOT_PASSWORD)

db = db.getSiblingDB('admin')

db.createUser({
user: process.env.MONGO_USER,
pwd: process.env.MONGO_PASSWORD,
roles: [
{
role: 'root',
db: 'admin',
},
],
});

db.dropUser(process.env.MONGO_INITDB_ROOT_USERNAME);

0 comments on commit f17ad05

Please sign in to comment.