Merge pull request #19 from NFDI4Chem/development #105
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
| name: Build NMR-Platform Docker Image | |
| on: | |
| push: | |
| branches: [main] | |
| env: | |
| REPOSITORY_NAME: nmr-platform | |
| DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
| REPOSITORY_NAMESPACE: nfdi4chem | |
| jobs: | |
| build-and-push: | |
| name: Build & Push Docker Image | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: Production | |
| url: https://platform.fsu.nmrxiv.org | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ env.DOCKER_HUB_USERNAME }} | |
| password: ${{ env.DOCKER_HUB_PASSWORD }} | |
| - name: Create composer auth file for Docker secrets | |
| env: | |
| COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }} | |
| run: | | |
| echo "$COMPOSER_AUTH" > auth.json | |
| echo "✅ Composer auth file created for Docker secrets" | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }} | |
| tags: latest | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./deployment/Dockerfile | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| secrets: | | |
| id=composer_auth,src=auth.json | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - 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 }}:latest /usr/local/bin/php --version | |
| echo "Testing if start-container script exists..." | |
| docker run --rm --entrypoint="" ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}: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 }}:latest /usr/local/bin/php artisan --version | |
| echo "Testing if supervisor configurations exist..." | |
| docker run --rm --entrypoint="" ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:latest ls -la /etc/supervisor/conf.d/ |