diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 538cd42..95c8242 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,7 @@ stages: before_script: - apt update -yqq - apt install -yqq git libzip-dev zip make wget gnupg2 libonig-dev libcurl4-openssl-dev + - apt-get clean # Prepare the environment setup: @@ -31,6 +32,37 @@ build: paths: - build/*.tar.gz +# Build the Alpine Docker image +build-docker-alpine: + stage: build-docker + script: + - | + if [[ ! -z "$CI_COMMIT_TAG" ]]; then + DOCKER_TAG="$CI_COMMIT_TAG-alpine" + else + DOCKER_TAG="$CI_COMMIT_REF_SLUG-alpine" + fi + + echo "Building Docker image with tag: $DOCKER_TAG" + docker build -f Dockerfile -t $CI_REGISTRY_IMAGE:$DOCKER_TAG . + docker push $CI_REGISTRY_IMAGE:$DOCKER_TAG + +# Build the Debian Docker image +build-docker-debian: + stage: build-docker + script: + - | + if [[ ! -z "$CI_COMMIT_TAG" ]]; then + DOCKER_TAG="$CI_COMMIT_TAG-debian" + else + DOCKER_TAG="$CI_COMMIT_REF_SLUG-debian" + fi + + echo "Building Docker image with tag: $DOCKER_TAG" + docker build -f Dockerfile.debian -t $CI_REGISTRY_IMAGE:$DOCKER_TAG . + docker push $CI_REGISTRY_IMAGE:$DOCKER_TAG + + # Publish the package publish: stage: publish diff --git a/Dockerfile b/Dockerfile index b0295ec..beb4f63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ # Builder stage: downloads necessary files and serves them on a silver platter. # -FROM php:8.1-fpm AS builder +FROM php:8.2-fpm AS builder WORKDIR /tmp # Install some stuff the default image doesn't come with @@ -36,15 +36,18 @@ RUN wget -O phive.phar https://phar.io/releases/phive.phar; gpg --verify phive.phar.asc phive.phar; \ rm phive.phar.asc; chmod +x phive.phar; ./phive.phar install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C +# Copy the local repository to the image +COPY . /tmp/ncc + # Download the latest version of ncc (Nosial Code Compiler) -RUN git clone https://git.n64.cc/nosial/ncc.git; \ - cd ncc; make redist +RUN cd /tmp/ncc && make redist + # # Main stage: Copies downloaded files and installs all # -FROM php:8.1-fpm-alpine +FROM php:8.2-fpm-alpine # Add extensions ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ diff --git a/Dockerfile.debian b/Dockerfile.debian index be0b4b2..557f96b 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -22,7 +22,7 @@ # Builder stage: downloads necessary files and serves them on a silver platter. # -FROM php:8.1-fpm AS builder +FROM php:8.2-fpm AS builder WORKDIR /tmp # Install some stuff the default image doesn't come with @@ -36,15 +36,18 @@ RUN wget -O phive.phar https://phar.io/releases/phive.phar; gpg --verify phive.phar.asc phive.phar; \ rm phive.phar.asc; chmod +x phive.phar; ./phive.phar install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C +# Copy the local repository to the image +COPY . /tmp/ncc + # Download the latest version of ncc (Nosial Code Compiler) -RUN git clone https://git.n64.cc/nosial/ncc.git; \ - cd ncc; make redist +RUN cd /tmp/ncc && make redist + # # Main stage: Copies downloaded files and installs all # -FROM php:8.1-fpm +FROM php:8.2-fpm # Add extensions ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ @@ -52,6 +55,10 @@ ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/do # Copy downloaded files COPY --from=builder /tmp/. . +# Install some stuff the default image doesn't come with +RUN apt update -yqq; \ + apt install git libpq-dev libzip-dev zip make wget gnupg -yqq + # Install extensions required to run ncc RUN install-php-extensions mbstring \ ctype \