Compare commits

..

4 Commits

Author SHA1 Message Date
d240f90a92
build docker image for multi arch
Some checks reported errors
mapguesser/pipeline/pr-develop Something is wrong with the build of this commit
2023-09-26 22:15:25 +02:00
390c13608a
Merge pull request 'set runner user of web service' (!79) from feature/set-runner-user-of-web-service into develop
All checks were successful
mapguesser/pipeline/head This commit looks good
Reviewed-on: #79
2023-09-26 22:07:40 +02:00
345cf31bb3
build and push docker image in one step
All checks were successful
mapguesser/pipeline/pr-develop This commit looks good
2023-09-26 22:00:18 +02:00
c7f5ea0d85
set runner user of web service 2023-09-26 21:56:29 +02:00
5 changed files with 24 additions and 8 deletions

2
Jenkinsfile vendored
View File

@ -97,7 +97,7 @@ pipeline {
-t git.esoko.eu/esoko/mapguesser:${env.VERSION} \
--push \
.""",
label: 'Build Docker image'
label: 'Build Docker image'
}
}
}

View File

@ -2,7 +2,7 @@ FROM ubuntu:focal AS mapg_base
ENV DEBIAN_FRONTEND noninteractive
RUN apt update --fix-missing && apt install -y curl git unzip mariadb-client nginx \
RUN apt update --fix-missing && apt install -y sudo curl git unzip mariadb-client nginx \
php-apcu php7.4-cli php7.4-curl php7.4-fpm php7.4-mbstring php7.4-mysql php7.4-zip php7.4-xml
RUN mkdir -p /run/php
@ -30,14 +30,15 @@ EXPOSE 8090
EXPOSE 9229
ENTRYPOINT docker/scripts/entry-point-dev.sh
FROM mapg_base AS mapg_release
RUN apt update --fix-missing && apt install -y cron
WORKDIR /var/www/mapguesser
COPY ./ /var/www/mapguesser
RUN chmod 777 /var/www/mapguesser/cache &&\
rm -rf /var/www/mapguesser/.git /var/www/mapguesser/.env
RUN docker/scripts/release.sh &&\
rm -rf /var/www/mapguesser/.git
EXPOSE 80
EXPOSE 8090

View File

@ -2,8 +2,6 @@
set -e
chmod 777 cache
echo "Installing Composer packages..."
if [ -f .env ]; then
composer install
@ -20,11 +18,18 @@ echo "Installing Yarn packages..."
echo "Migrating DB..."
./mapg db:migrate
echo "Set runner user based on owner of .env..."
USER_UID=$(stat -c "%u" .env)
USER_GID=$(stat -c "%g" .env)
groupadd --gid $USER_GID mapg
useradd --uid $USER_UID --gid $USER_GID mapg
sed -i -e "s/^user = .*$/user = mapg/g" -e "s/^group = .*$/group = mapg/g" /etc/php/7.4/fpm/pool.d/www.conf
set +e
/usr/sbin/php-fpm7.4 -F &
/usr/sbin/nginx -g 'daemon off;' &
/usr/bin/node --inspect=0.0.0.0:9229 multi &
sudo -u mapg -g mapg /usr/bin/node --inspect=0.0.0.0:9229 multi &
wait -n

View File

@ -8,12 +8,20 @@ echo "Migrating DB..."
echo "Installing crontab..."
/usr/bin/crontab docker/scripts/cron
echo "Set runner user based on owner of .env..."
USER_UID=$(stat -c "%u" .env)
USER_GID=$(stat -c "%g" .env)
groupadd --gid $USER_GID mapg
useradd --uid $USER_UID --gid $USER_GID mapg
chown mapg:mapg cache
sed -i -e "s/^user = .*$/user = mapg/g" -e "s/^group = .*$/group = mapg/g" /etc/php/7.4/fpm/pool.d/www.conf
set +e
/usr/sbin/cron -f &
/usr/sbin/php-fpm7.4 -F &
/usr/sbin/nginx -g 'daemon off;' &
/usr/bin/node multi &
sudo -u mapg -g mapg /usr/bin/node multi &
wait -n

View File

@ -26,3 +26,5 @@ find public/static/img -type f -iname '*.svg' -exec svgo {} -o {} \;
echo "Linking view files..."
./mapg view:link
rm .env