! Published.
All checks were successful
Build the "latest" docker image / build_docker_image (push) Successful in 26s
Build docker image / build_docker_image (push) Successful in 28s

This commit is contained in:
2025-05-03 11:09:41 +02:00
commit 19dea8f983
82 changed files with 14408 additions and 0 deletions

68
build/default/Dockerfile Normal file
View File

@@ -0,0 +1,68 @@
ARG ALPINE_VERSION=3.21
FROM alpine:${ALPINE_VERSION}
# initialize arguments
ARG PHP_VERSION=82
ARG USER_ID=1000
ARG GROUP_ID=1000
ARG WORKDIR=/app/Bot
# install dependencies
RUN apk add \
bash \
git \
icu-data-full \
php${PHP_VERSION} \
php${PHP_VERSION}-fpm \
php${PHP_VERSION}-curl \
php${PHP_VERSION}-intl \
php${PHP_VERSION}-dom \
php${PHP_VERSION}-fileinfo \
php${PHP_VERSION}-iconv \
php${PHP_VERSION}-mbstring \
php${PHP_VERSION}-openssl \
php${PHP_VERSION}-pdo \
php${PHP_VERSION}-pdo_sqlite \
php${PHP_VERSION}-phar \
php${PHP_VERSION}-opcache \
php${PHP_VERSION}-session \
php${PHP_VERSION}-simplexml \
php${PHP_VERSION}-sqlite3 \
php${PHP_VERSION}-tokenizer \
php${PHP_VERSION}-xml \
php${PHP_VERSION}-xmlreader \
php${PHP_VERSION}-xmlwriter \
php${PHP_VERSION}-zip \
&& ln -s /usr/bin/php${PHP_VERSION} /usr/bin/php
# add user and group for the app
RUN addgroup -g ${GROUP_ID} bot \
&& adduser -u ${USER_ID} -G bot -D bot \
&& mkdir -p ${WORKDIR}/Storage/Logs \
&& chown -R ${USER_ID}:${GROUP_ID} ${WORKDIR}
# install composer
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
# set the workdir
WORKDIR ${WORKDIR}
# copy the application
COPY --chown=${USER_ID}:${GROUP_ID} src/ .
# change to the user
USER ${USER_ID}:${GROUP_ID}
# initialize composer
RUN composer install \
--no-interaction \
--no-dev \
--optimize-autoloader
# define the storage volume
VOLUME [ "/app/Bot/Storage" ]
# setting entrypoint
ENTRYPOINT [ "php", "Bot.php" ]

57
build/default/build.sh Executable file
View File

@@ -0,0 +1,57 @@
#!/bin/bash
# ---------------------------------------------------------------------------
# setting constants
PACKAGE_REPOSITORY=proxima.goliath.hu/proxima/discord-bot
BUILD_TAG=default
UID=$(id -u)
GID=$(id -g)
# ---------------------------------------------------------------------------
clear
echo This is a sample build script, if the workflow cannot be used.
echo Please customize the repository address/name for your own.
echo
# ---------------------------------------------------------------------------
echo Building "${BUILD_TAG}" package ..
echo
# ---------------------------------------------------------------------------
echo Changing to project root directory...
pushd ../.. > /dev/null
# ---------------------------------------------------------------------------
echo Determining tag name...
branch=$(git branch --show-current)
tag=temp
[[ $branch == dev ]] && tag=testing
[[ $branch == main ]] && tag=latest
[[ $branch == master ]] && tag=latest
# ---------------------------------------------------------------------------
echo Building image...
docker buildx build . \
--tag ${PACKAGE_REPOSITORY}:$tag \
--build-arg GROUP_ID=${GID} \
--build-arg USER_ID=${UID} \
--file build/${BUILD_TAG}/Dockerfile \
--platform linux/amd64,linux/arm64 \
--provenance=false \
--sbom=false \
# --push \
# ---------------------------------------------------------------------------
echo Changing back to build directory...
popd > /dev/null
# ---------------------------------------------------------------------------
echo Done.