-
Notifications
You must be signed in to change notification settings - Fork 9
Docker publish workflow #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,58 @@ | ||||||||||||||||||||||||||||||||||
| name: Build And Publish Container | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||||||||||
| - docker-publish | ||||||||||||||||||||||||||||||||||
| tags: | ||||||||||||||||||||||||||||||||||
| - 'v*' | ||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||||||||||
| - docker-publish | ||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||
| DOCKERHUB_IMAGE: tatevikg1/phplist4 | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Major: Use organization Docker Hub account instead of personal account. The workflow uses
📝 Suggested change env:
- DOCKERHUB_IMAGE: tatevikg1/phplist4
+ DOCKERHUB_IMAGE: phplist/base-distributionNote: Update the corresponding secrets to use the organization account credentials. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||
| docker: | ||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-22.04 | ||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||
| - name: Checkout | ||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Set up QEMU | ||||||||||||||||||||||||||||||||||
| uses: docker/setup-qemu-action@v3 | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Set up Docker Buildx | ||||||||||||||||||||||||||||||||||
| uses: docker/setup-buildx-action@v3 | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Log in to Docker Hub | ||||||||||||||||||||||||||||||||||
| if: github.event_name != 'pull_request' | ||||||||||||||||||||||||||||||||||
| uses: docker/login-action@v3 | ||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||||||||||||||||||||||||||||||||||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Extract Docker metadata | ||||||||||||||||||||||||||||||||||
| id: meta | ||||||||||||||||||||||||||||||||||
| uses: docker/metadata-action@v5 | ||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||
| images: ${{ env.DOCKERHUB_IMAGE }} | ||||||||||||||||||||||||||||||||||
| tags: | | ||||||||||||||||||||||||||||||||||
| type=raw,value=test,enable={{is_default_branch}} | ||||||||||||||||||||||||||||||||||
| type=ref,event=tag | ||||||||||||||||||||||||||||||||||
| type=sha,prefix=sha- | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+44
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tag strategy may not work as intended. The tag configuration uses If you intend to tag builds from a specific branch as "test", update the tag condition or the workflow triggers to align. 🏷️ Alternative tag strategiesOption 1: Match the branch name directly tags: |
- type=raw,value=test,enable={{is_default_branch}}
+ type=raw,value=test,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=tag
type=sha,prefix=sha-Option 2: Use branch name as tag tags: |
- type=raw,value=test,enable={{is_default_branch}}
+ type=ref,event=branch
type=ref,event=tag
type=sha,prefix=sha-📝 Committable suggestion
Suggested change
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - name: Build and push image | ||||||||||||||||||||||||||||||||||
| uses: docker/build-push-action@v6 | ||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||
| context: . | ||||||||||||||||||||||||||||||||||
| file: ./Dockerfile | ||||||||||||||||||||||||||||||||||
| platforms: linux/amd64,linux/arm64 | ||||||||||||||||||||||||||||||||||
| push: ${{ github.event_name != 'pull_request' }} | ||||||||||||||||||||||||||||||||||
| tags: ${{ steps.meta.outputs.tags }} | ||||||||||||||||||||||||||||||||||
| labels: ${{ steps.meta.outputs.labels }} | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ services: | |||||||||||
| image: tatevikg1/phplist:test | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use organization Docker Hub account for consistency. Similar to the workflow configuration, this image reference uses a personal Docker Hub account ( Suggested change app:
build: .
- image: tatevikg1/phplist:test
+ image: phplist/base-distribution:test
container_name: base-distribution-app📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
| container_name: base-distribution-app | ||||||||||||
| ports: | ||||||||||||
| - "${PHPLIST_PORT:-8081}:80" | ||||||||||||
| - "${PHPLIST_PORT:-8081}:8081" | ||||||||||||
| environment: | ||||||||||||
| # Database connection (mirrors config/parameters.yml expectations) | ||||||||||||
| PHPLIST_DATABASE_NAME: phplistdb | ||||||||||||
|
|
@@ -13,9 +13,9 @@ services: | |||||||||||
| PHPLIST_DATABASE_DRIVER: ${PHPLIST_DATABASE_DRIVER:-pdo_mysql} # pdo_pgsql | ||||||||||||
| PHPLIST_DATABASE_HOST: ${PHPLIST_DATABASE_HOST:-db} # postgres | ||||||||||||
| PHPLIST_DATABASE_PORT: ${PHPLIST_DATABASE_PORT:-3306} # 5432 | ||||||||||||
| REST_API_BASE_URL: 'http://app/' | ||||||||||||
| FRONT_END_BASE_URL: 'http://app/' | ||||||||||||
| API_BASE_URL: 'http://app/' | ||||||||||||
| REST_API_BASE_URL: 'http://app:8081/' | ||||||||||||
| FRONT_END_BASE_URL: 'http://app:8081/' | ||||||||||||
| API_BASE_URL: 'http://app:8081/' | ||||||||||||
|
|
||||||||||||
| # Symfony environment | ||||||||||||
| APP_ENV: prod | ||||||||||||
|
|
@@ -25,6 +25,9 @@ services: | |||||||||||
| volumes: | ||||||||||||
| - ./var/logs:/var/www/html/var/log | ||||||||||||
| - ./var/cache:/var/www/html/var/cache | ||||||||||||
| - ./docker/apache/servername.conf:/etc/apache2/conf-enabled/servername.conf:ro | ||||||||||||
| - ./docker/apache/ports.conf:/etc/apache2/ports.conf:ro | ||||||||||||
| - ./docker/apache/000-default.conf:/etc/apache2/sites-available/000-default.conf:ro | ||||||||||||
| networks: [ appnet ] | ||||||||||||
|
|
||||||||||||
| command: > | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <VirtualHost *:8081> | ||
| ServerName app | ||
| DocumentRoot /var/www/html/public | ||
|
|
||
| <Directory /var/www/html/public> | ||
| AllowOverride All | ||
| Require all granted | ||
| </Directory> | ||
|
|
||
| ErrorLog ${APACHE_LOG_DIR}/error.log | ||
| CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
| </VirtualHost> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Listen 8081 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ServerName app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Workflow branch configuration mismatch.
The workflow triggers on the
docker-publishbranch (lines 5-6 and 10-11), but this PR is targeting themainbranch. Once merged tomain, this workflow will not trigger on future pushes tomain.This means:
mainwon't build/publish Docker imagesdocker-publishbranchUpdate the trigger branches to include
main:🔧 Proposed fix
on: push: branches: - - docker-publish + - main tags: - 'v*' pull_request: branches: - - docker-publish + - main workflow_dispatch:📝 Committable suggestion
🤖 Prompt for AI Agents