Merge pull request #760 from Steinbeck-Lab/fix-pipeline-scoping #466
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This worklflow will perform following actions when the code is pushed to development branch: | |
| # - Build the latest docker image in development. | |
| # - Push the latest docker image to Docker Hub. | |
| # | |
| # Maintainers: | |
| # - name: Nisha Sharma | |
| # - email: nisha.sharma@uni-jena.de | |
| # - name: Chandu Nainala | |
| # - email: chandu.nainala@uni-jena.de | |
| name : Development - Build COCONUT image and push to Docker Hub | |
| on: | |
| push: | |
| branches: [development] | |
| env: | |
| REPOSITORY_NAME: coconut | |
| DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| APP_IMAGE: coconut-app | |
| REPOSITORY_NAMESPACE: nfdi4chem | |
| jobs: | |
| setup-build-publish-deploy-dev: | |
| name: Build & deploy to development | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: Dev | |
| url: https://dev.coconut.naturalproducts.net | |
| steps: | |
| # Checkout code | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # Login to Docker | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ env.DOCKER_HUB_USERNAME }} | |
| password: ${{ env.DOCKER_HUB_PASSWORD }} | |
| - name: set composer auth for private repos | |
| env: | |
| COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} | |
| run: | | |
| echo $COMPOSER_AUTH | base64 -d > auth.json | |
| echo "✅ Composer auth file created for Docker secrets" | |
| # Build and push the app Docker image | |
| - name: Build and push App Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| platforms: linux/amd64 | |
| build-args: | | |
| RELEASE_VERSION=latest | |
| secrets: | | |
| id=composer_auth,src=auth.json | |
| tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Remove composer auth file | |
| - name: Remove composer auth file | |
| run: rm -f auth.json | |
| - name: Test built image | |
| run: | | |
| echo "Testing if PHP is available..." | |
| docker run --rm --workdir=/app --entrypoint="" ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-latest /usr/local/bin/php --version | |
| echo "Testing if start-container script exists..." | |
| docker run --rm --entrypoint="" ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-latest ls -la /usr/local/bin/start-container | |
| echo "Testing if Laravel application is properly set up..." | |
| docker run --rm --workdir=/app --entrypoint="" ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-latest /usr/local/bin/php artisan --version | |
| echo "Testing if supervisor configurations exist..." | |
| docker run --rm --entrypoint="" ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-latest ls -la /etc/supervisor/conf.d/ |