diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index ff5be74..a473e96 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -20,11 +20,15 @@ jobs: java-version: '17' distribution: 'temurin' - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + - name: Set environment variables + run: | + echo "CONFIG_SERVER_URL=${{secrets.CONFIG_SERVER_URL}}" >> $GITHUB_ENV - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + - name: Substitute variables in application.yml + run: | + apt-get update && apt-get install -y gettext-base + envsubst < src/main/resources/application.yml > src/main/resources/application.yml.temp + mv src/main/resources/application.yml.temp src/main/resources/application.yml - name: Grant execute permission for gradlew run: chmod +x gradlew @@ -49,7 +53,10 @@ jobs: password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Build docker image - run: docker buildx build --platform linux/amd64,linux/arm64 -t ${{ secrets.DOCKERHUB_USERNAME }}/eureka-server:latest --push -f Dockerfile . + run: docker build --build-arg KAFKA_BOOTSTRAP_SERVERS=${{ secrets.KAFKA_BOOTSTRAP_SERVERS }} -t ${{ secrets.DOCKERHUB_USERNAME }}/eureka-server:latest -f Dockerfile . + + - name: Push docker hub + run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/eureka-server:latest run-docker-image-on-ec2: needs: build-docker-image diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 49a878d..11a4580 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,3 +1,3 @@ spring: config: - import: optional:configserver:http://52.79.127.196:8071 \ No newline at end of file + import: optional:configserver:${CONFIG_SERVER_URL} \ No newline at end of file