Skip to content

Commit

Permalink
Fixing docker build. Increase versions of all images.
Browse files Browse the repository at this point in the history
  • Loading branch information
thisismeonmounteverest committed Dec 29, 2024
1 parent 3c804a3 commit 16b5375
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 24 deletions.
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@


# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG PHP_VERSION=7.4.28
ARG NGINX_VERSION=1.17
ARG PHP_VERSION=8.3
ARG NGINX_VERSION=1.27.3


# "php" stage
FROM php:${PHP_VERSION}-fpm-alpine3.15 AS bewelcome_php
FROM php:${PHP_VERSION}-fpm-alpine3.21 AS bewelcome_php

# persistent / runtime deps
RUN apk add --no-cache \
Expand All @@ -25,7 +25,7 @@ RUN apk add --no-cache \
python3 \
;

ARG APCU_VERSION=5.1.18
ARG APCU_VERSION=5.1.24
RUN set -eux; \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
Expand All @@ -46,7 +46,6 @@ RUN set -eux; \
mysqli \
pcntl \
pdo_mysql \
xmlrpc \
xsl \
zip \
exif \
Expand Down Expand Up @@ -126,7 +125,7 @@ RUN set -eux; \
composer clear-cache

# prevent the reinstallation of node_modules at every changes in the source code
COPY package.json yarn.lock webpack.config.js postcss.config.js tailwind.config.js ./
COPY package.json yarn.lock webpack.config.js postcss.config.js tailwind.config.js tsconfig.json ./
RUN set -eux; \
yarn install --frozen-lock; \
yarn encore production --mode=production
Expand Down
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ phpci: phpcpd phploc phpmd php-code-sniffer phpunit infection behat version
install:
git rev-parse --short HEAD > VERSION
test -f docker-compose.override.yml || cp docker-compose.override.yml.dist docker-compose.override.yml
curl https://downloads.bewelcome.org/for_developers/rox_test_db/languages.sql.bz2 -o ./docker/db/languages.sql.bz2
curl https://downloads.bewelcome.org/for_developers/rox_test_db/words.sql.bz2 -o ./docker/db/words.sql.bz2
bunzip2 --force ./docker/db/languages.sql.bz2 ./docker/db/words.sql.bz2
bzip2 -ckd docker/languages.sql.bz2 > docker/db/languages.sql
bzip2 -ckd docker/words.sql.bz2 > docker/db/words.sql
ifdef root
sudo docker-compose up -d
sudo docker compose up -d
else
docker-compose up -d
docker compose up -d
endif

install-geonames:
Expand All @@ -34,9 +33,9 @@ install-geonames:
unzip docker/db/alternateNames.zip -d docker/db/
rm docker/db/*.zip
ifdef root
sudo docker-compose exec php sh -c "mysql bewelcome -u bewelcome -pbewelcome -h db < import.sql"
sudo docker compose exec php sh -c "mysql bewelcome -u bewelcome -pbewelcome -h db < import.sql"
else
docker-compose exec php sh -c "mysql bewelcome -u bewelcome -pbewelcome -h db < import.sql"
docker compose exec php sh -c "mysql bewelcome -u bewelcome -pbewelcome -h db < import.sql"
endif

phpcsfix:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.override.yml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.4'

services:
web:
ports:
Expand Down
6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.4'

x-cache-from:
- &cache-from
cache_from:
Expand Down Expand Up @@ -41,7 +39,7 @@ services:
- ./public:/srv/bewelcome/public:ro

db:
image: mariadb:10.1.41
image: mariadb:11.6.2
environment:
MYSQL_ROOT_PASSWORD: bewelcome_root_dev
MYSQL_DATABASE: bewelcome
Expand All @@ -52,7 +50,7 @@ services:

manticore:
container_name: manticore
image: manticoresearch/manticore:5.0.2
image: manticoresearch/manticore:6.3.8
environment:
- EXTRA=1
restart: always
Expand Down
Binary file added docker/languages.sql.bz2
Binary file not shown.
20 changes: 16 additions & 4 deletions docker/php/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,32 +52,44 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
sleep 1
done

echo "db ready!"
if [ "$APP_ENV" != 'prod' ]; then
echo "Creating database..."
bin/console test:database:create --drop --force --no-interaction
echo "Database created."

database_host=$(grep '^DB_HOST=' .env | cut -f 2 -d '=')
database_port=$(grep '^DB_PORT=' .env | cut -f 2 -d '=')
database_name=$(grep '^DB_NAME=' .env | cut -f 2 -d '=')
database_user=$(grep '^DB_USER=' .env | cut -f 2 -d '=')
database_password=$(grep '^DB_PASS=' .env | cut -f 2 -d '=')
echo "$database_name"
echo "$database_port"
echo "$database_user"
echo "$database_password"
if [ -f docker/db/languages.sql ]; then
mysql $database_name -u $database_user -p$database_password -h $database_host < docker/db/languages.sql
mariadb $database_name -u $database_user -p$database_password -h $database_host < docker/db/languages.sql
fi
if [ -f docker/db/words.sql ]; then
mysql $database_name -u $database_user -p$database_password -h $database_host < docker/db/words.sql
mariadb $database_name -u $database_user -p$database_password -h $database_host < docker/db/words.sql
fi
if [ -f docker/db/geonamesadminunits.sql ]; then
mysql $database_name -u $database_user -p$database_password -h $database_host < docker/db/geonamesadminunits.sql
mariadb $database_name -u $database_user -p$database_password -h $database_host < docker/db/geonamesadminunits.sql
fi
echo "Database updated!"
elif ls -A src/Migrations/*.php > /dev/null 2>&1; then
echo "migration"
bin/console doctrine:migrations:migrate --no-interaction
fi

echo "warmup"
# WarmUp translations now database is up to date
composer run-script --no-dev post-install-cmd

if [ "$APP_ENV" != 'prod' ]; then
echo "yarn"
yarn encore dev --mode=development
fi
fi
echo "docker-php"

exec docker-php-entrypoint "$@"
Binary file added docker/words.sql.bz2
Binary file not shown.
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{}
{
"files": [
"assets/js/admin/tools/login_message.ts"
]
}

0 comments on commit 16b5375

Please sign in to comment.