diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3c5f04..72000e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,9 +11,5 @@ jobs: build-and-push: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: docker login - run: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD - - name: Run build script run: chmod +x ./build.sh && ./build.sh \ No newline at end of file diff --git a/build.sh b/build.sh index 36b69c6..ee95bc3 100644 --- a/build.sh +++ b/build.sh @@ -1,11 +1,5 @@ #!/bin/bash -# Exit if Docker credentials are not set -if [ -z "$DOCKER_USER" ] || [ -z "$DOCKER_PASSWORD" ]; then - echo "Docker username or password not set." - exit 1 -fi - # Login to Docker registry docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" @@ -15,26 +9,26 @@ versions=(8.0.30 8.1.29 8.2.20 8.3.8) # Iterate through each version for version in "${versions[@]}"; do # Extract major and minor version for image tag - major_minor=$(echo $version | cut -d '.' -f1,2 | tr -d '.') + major_minor=$(echo "$version" | cut -d '.' -f1,2 | tr -d '.') # Define repository name REPOSITORY="${REPO}:php$major_minor" # Build and push image without xdebug docker build . --file php.Dockerfile \ - --build-arg PHP_VERSION=$version \ + --build-arg PHP_VERSION="$version" \ --build-arg NODE_VERSION=20 \ --build-arg WITH_XDEBUG=false \ --no-cache \ - --tag $REPOSITORY - docker push $REPOSITORY + --tag "$REPOSITORY" \ + --push # Build and push image with xdebug docker build . --file php.Dockerfile \ - --build-arg PHP_VERSION=$version \ + --build-arg PHP_VERSION="$version" \ --build-arg NODE_VERSION=20 \ --build-arg WITH_XDEBUG=true \ --no-cache \ - --tag $REPOSITORY-xdebug - docker push $REPOSITORY-xdebug + --tag "$REPOSITORY"-xdebug \ + --push done