Skip to content
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
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ RUN sed -i "s/user = nobody/user = phpbb/g" /etc/php${PHP_VERSION}/php-fpm.d/www
COPY scripts/install-phpbb.sh scripts/docker-entrypoint.sh scripts/install-from-yml.sh /opt/.docker/
COPY config/nginx.conf /etc/nginx/http.d/default.conf

# Copy phpbb artefact fixed version
COPY artefacts/phpbb.zip /tmp/phpbb.zip

# Download and install phpBB during the build
RUN if [ -z "${PHPBB_VERSION}" ]; then \
echo "ERROR: PHPBB_VERSION build argument is not set" && exit 1; \
Expand All @@ -135,10 +138,10 @@ RUN if [ -z "${PHPBB_VERSION}" ]; then \
echo "ERROR: Could not extract major.minor version from ${PHPBB_VERSION}" && exit 1; \
fi && \
# Download and extract phpBB
DOWNLOAD_URL="https://download.phpbb.com/pub/release/${MAJOR_MINOR_VERSION}/${PHPBB_VERSION}/phpBB-${PHPBB_VERSION}.zip" && \
echo "Downloading from: ${DOWNLOAD_URL}" && \
# DOWNLOAD_URL="https://download.phpbb.com/pub/release/${MAJOR_MINOR_VERSION}/${PHPBB_VERSION}/phpBB-${PHPBB_VERSION}.zip" && \
# echo "Downloading from: ${DOWNLOAD_URL}" && \
cd /tmp && \
curl -L -o phpbb.zip "${DOWNLOAD_URL}" && \
# curl -L -o phpbb.zip "${DOWNLOAD_URL}" && \
unzip phpbb.zip && \
rm phpbb.zip && \
# Move files to destination and set up directories
Expand Down
Binary file added artefacts/phpBB-3.3.15.zip
Binary file not shown.
1 change: 1 addition & 0 deletions artefacts/phpbb.zip
22 changes: 13 additions & 9 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ PATCH_VERSION=$VERSION
log "Version components: Major=$MAJOR_VERSION, Minor=$MINOR_VERSION, Patch=$PATCH_VERSION"

# Set image name base
DOCKER_IMAGE=${DOCKER_IMAGE:-"evandarwin/phpbb"}
DOCKER_IMAGE=${DOCKER_IMAGE:-"basbe/phpbb"}

# Build the Docker image with PHP 8.4
log "==> Building phpBB Docker image"
Expand All @@ -81,21 +81,25 @@ log " image name :: $DOCKER_IMAGE:$VERSION"
# Set build args
BUILD_ARGS="--build-arg PHPBB_VERSION=$VERSION --build-arg PHP_VERSION=84 --build-arg ALPINE_VERSION=edge"

# Enable buildx
docker buildx create --use
docker buildx inspect --bootstrap

# Build the Docker image
docker build \
docker buildx build --platform linux/amd64,linux/arm64 \
$BUILD_ARGS \
-t "$DOCKER_IMAGE:$VERSION" \
.
. --push

# Create additional version tags
docker tag "$DOCKER_IMAGE:$VERSION" "$DOCKER_IMAGE:$MINOR_VERSION"
log "Tagged $VERSION as $MINOR_VERSION"
# docker tag "$DOCKER_IMAGE:$VERSION" "$DOCKER_IMAGE:$MINOR_VERSION"
# log "Tagged $VERSION as $MINOR_VERSION"

docker tag "$DOCKER_IMAGE:$VERSION" "$DOCKER_IMAGE:$MAJOR_VERSION"
log "Tagged $VERSION as $MAJOR_VERSION"
# docker tag "$DOCKER_IMAGE:$VERSION" "$DOCKER_IMAGE:$MAJOR_VERSION"
# log "Tagged $VERSION as $MAJOR_VERSION"

docker tag "$DOCKER_IMAGE:$VERSION" "$DOCKER_IMAGE:latest"
log "Tagged $VERSION as latest"
# docker tag "$DOCKER_IMAGE:$VERSION" "$DOCKER_IMAGE:latest"
# log "Tagged $VERSION as latest"

log "==> Build complete!"

Expand Down
22 changes: 11 additions & 11 deletions scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,17 @@ check_database_connectivity() {
fi

# Try connecting to MySQL with appropriate arguments
if command -v mysql >/dev/null 2>&1; then
log "Testing MySQL connection to $db_host..."
if ! mysql -h "$db_host" ${db_port:+-P "$db_port"} -u "$db_user" ${db_pass:+-p"$db_pass"} -e "SELECT 1" >/dev/null 2>&1; then
log "WARNING: Could not connect to MySQL server at $db_host. phpBB may not function correctly!"
result=0 # Don't fail the container, just warn
else
log "MySQL connectivity test successful"
fi
else
log "WARNING: MySQL client not available, skipping connectivity check"
fi
# if command -v mysql >/dev/null 2>&1; then
# log "Testing MySQL connection to $db_host..."
# if ! mysql -h "$db_host" ${db_port:+-P "$db_port"} -u "$db_user" ${db_pass:+-p"$db_pass"} -e "SELECT 1" >/dev/null 2>&1; then
# log "WARNING: Could not connect to MySQL server at $db_host. phpBB may not function correctly!"
# result=0 # Don't fail the container, just warn
# else
# log "MySQL connectivity test successful"
# fi
# else
# log "WARNING: MySQL client not available, skipping connectivity check"
# fi
;;

postgres)
Expand Down
34 changes: 18 additions & 16 deletions scripts/install-from-yml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,27 @@ test_db_connection() {

case "$driver" in
mysqli)
# Set default MySQL port if not specified
[ -z "$port" ] && port="3306"
# # Set default MySQL port if not specified
# [ -z "$port" ] && port="3306"

if command -v mysql > /dev/null 2>&1; then
log "Testing MySQL connection to $host:$port..."
if ! mysql -h "$host" -P "$port" -u "$user" ${pass:+-p"$pass"} -e "SELECT 1" > /dev/null 2>&1; then
log "ERROR: Failed to connect to MySQL database"
return 1
fi
# if command -v mysql > /dev/null 2>&1; then
# log "Testing MySQL connection to $host:$port..."
# echo "mysql -h $host -P $port -u $user --password=$pass $name"
# #if ! mysql -h "$host" -P "$port" -u "$user" ${pass:+-p"$pass"} -e "SELECT 1" > /dev/null 2>&1; then
# if ! mysql -h "$host" -P "$port" -u "$user" --password="$pass" "$name" -e "SELECT 1" > /dev/null 2>&1; then
# log "ERROR: Failed to connect to MySQL database"
# return 1
# fi

# Test if database exists or we can create it
if ! mysql -h "$host" -P "$port" -u "$user" ${pass:+-p"$pass"} -e "USE \`$name\`" > /dev/null 2>&1; then
log "Database '$name' doesn't exist, will be created during installation"
fi
# # Test if database exists or we can create it
# if ! mysql -h "$host" -P "$port" -u "$user" ${pass:+-p"$pass"} -e "USE \`$name\`" > /dev/null 2>&1; then
# log "Database '$name' doesn't exist, will be created during installation"
# fi

log "MySQL connection successful"
else
log "WARNING: mysql client not found, skipping connection test"
fi
# log "MySQL connection successful"
# else
# log "WARNING: mysql client not found, skipping connection test"
# fi
;;

postgres)
Expand Down