Skip to content

Commit

Permalink
Merge pull request #25 from itsmng/fix_for_kubernetes
Browse files Browse the repository at this point in the history
Fix for kubernetes
  • Loading branch information
minzords authored Dec 11, 2024
2 parents 63c673b + ef0cda0 commit eb7723b
Show file tree
Hide file tree
Showing 17 changed files with 102 additions and 127 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,25 @@ jobs:
ghcr.io/itsmng/itsm-ng:latest
docker.io/itsmng/itsm-ng:${{ github.ref_name }}
docker.io/itsmng/itsm-ng:latest
build-args: |
VERSION=${{ github.ref_name }}
context: latest
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64



- name: Build and push cron image
uses: docker/build-push-action@v6
with:
push: true
tags: |
ghcr.io/itsmng/itsm-ng:${{ github.ref_name }}-cron
ghcr.io/itsmng/itsm-ng:latest-cron
build-args: |
VERSION=${{ github.ref_name }}
context: cron
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
27 changes: 0 additions & 27 deletions 1.6.5/Dockerfile

This file was deleted.

14 changes: 0 additions & 14 deletions 1.6.5/Makefile

This file was deleted.

40 changes: 0 additions & 40 deletions 1.6.5/docker-compose.yml

This file was deleted.

15 changes: 0 additions & 15 deletions 1.6.5/docker-entrypoint.d/10-postinstall.sh

This file was deleted.

9 changes: 0 additions & 9 deletions 1.6.5/files/itsm-ng.conf

This file was deleted.

17 changes: 17 additions & 0 deletions cron/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ghcr.io/itsmng/itsm-ng:latest-cron

ARG REPO="itsmng"
ARG VERSION

RUN apt update &&\
apt install wget -y && \
cd /var/www && \
wget -q "https://github.com/$REPO/itsm-ng/releases/download/v$VERSION/itsm-ng-v$VERSION.tgz" && \
tar -xf itsm-ng-v${VERSION}.tgz && \
rm -rf itsm-ng-v${VERSION}.tgz

COPY ./docker-entrypoint.sh /docker-entrypoint.sh
COPY ./docker-entrypoint.d /docker-entrypoint.d

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD exit
7 changes: 7 additions & 0 deletions cron/docker-entrypoint.d/10-check_bdd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# Wait for MySQL to be ready
until nc -z -v -w30 $MARIADB_HOST 3306; do
echo "Waiting for MySQL connection..."
sleep 2
done
3 changes: 3 additions & 0 deletions cron/docker-entrypoint.d/20-cron.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

php /var/www/itsm-ng/front/cron.php
5 changes: 5 additions & 0 deletions cron/docker-entrypoint.d/30-ocsinventory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

if [ -f /var/www/itsm-ng/plugins/ocsinventoryng/scripts/run.php ]; then
php /var/www/itsm-ng/plugins/ocsinventoryng/scripts/run.php
fi
File renamed without changes.
4 changes: 2 additions & 2 deletions latest/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM debian:bookworm-slim

ARG REPO="itsmng"
ARG VERSION=2.0.2
ARG VERSION

RUN apt update && apt dist-upgrade -y && \
apt install -y apache2 wget php php-fpm php-mysql php-intl php-mbstring php-gd php-ldap php-simplexml php-curl php-apcu php-xmlrpc && \
apt install -y apache2 wget php php-fpm php-mysql php-intl php-mbstring php-gd php-ldap php-simplexml php-curl php-apcu php-xmlrpc netcat-traditional && \
a2enmod proxy_fcgi setenvif && \
a2enconf php8.2-fpm && \
apt-get -y clean && \
Expand Down
18 changes: 18 additions & 0 deletions latest/docker-entrypoint.d/10-fix-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

if [ ! -d /var/www/itsm-ng/files/_cache ]; then
mkdir -pv /var/www/itsm-ng/files/_cache \
/var/www/itsm-ng/files/_cron \
/var/www/itsm-ng/files/_dumps \
/var/www/itsm-ng/files/_graphs \
/var/www/itsm-ng/files/_lock \
/var/www/itsm-ng/files/_pictures \
/var/www/itsm-ng/files/_plugins \
/var/www/itsm-ng/files/_rss \
/var/www/itsm-ng/files/_sessions \
/var/www/itsm-ng/files/_tmp \
/var/www/itsm-ng/files/_uploads

chown -R www-data:www-data /var/www/itsm-ng/files
fi

20 changes: 0 additions & 20 deletions latest/docker-entrypoint.d/10-postinstall.sh

This file was deleted.

13 changes: 13 additions & 0 deletions latest/docker-entrypoint.d/20-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# Wait for MySQL to be ready
until nc -z -v -w30 $MARIADB_HOST 3306; do
echo "Waiting for MySQL connection..."
sleep 2
done

# Run the installation if config_db.php doesn't exist
if [ ! -f /var/www/itsm-ng/config/config_db.php ]; then
chmod -R 777 /var/www/itsm-ng/files/_sessions
cd /var/www/itsm-ng && php bin/console itsmng:database:install -H $MARIADB_HOST -u $MARIADB_USER -p $MARIADB_PASSWORD -d $MARIADB_DATABASE -n
fi
12 changes: 12 additions & 0 deletions latest/docker-entrypoint.d/30-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# Wait for MySQL to be ready
until nc -z -v -w30 $MARIADB_HOST 3306; do
echo "Waiting for MySQL connection..."
sleep 2
done

# Run the update if config_db.php exist
if [ -f /var/www/itsm-ng/config/config_db.php ]; then
cd /var/www/itsm-ng && php bin/console itsmng:database:update -n
fi
5 changes: 5 additions & 0 deletions latest/docker-entrypoint.d/40-fix-permission.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

if [ -f /var/www/itsm-ng/config/config_db.php ]; then
chown -R www-data:www-data /var/www/itsm-ng/files
fi

0 comments on commit eb7723b

Please sign in to comment.