Skip to content

Commit 8aef04b

Browse files
TatevikGrtatevikg1
andauthored
Docker publish workflow (#115)
* release: dev → main (add frontend build system) (#110) New Features Modern frontend build and bundling setup with Node/Yarn support and asset compilation CORS support enabled for API compatibility Chores Updated build tooling and runtime dependencies; added image processing support in the runtime environment Docker and compose improvements for build steps and persistent logs/cache; adjusted ignore rules Tests Added test bootstrap and improved server-error assertion in endpoint tests Documentation Added instructions to build and publish frontend assets --------- Co-authored-by: Tatevik <tatevikg1@gmail.com> * Add dockerhub publish workflow * Fix docker compose configs * Update docker-publish workflow to trigger on main and dev branches * Add todo * Update tags strategy in docker-publish workflow --------- Co-authored-by: Tatevik <tatevikg1@gmail.com>
1 parent 0f28f6e commit 8aef04b

5 files changed

Lines changed: 80 additions & 4 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build And Publish Container
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
tags:
9+
- 'v*'
10+
workflow_dispatch:
11+
12+
env:
13+
# todo: change to phplist dockerhub
14+
DOCKERHUB_IMAGE: tatevikg1/phplist4
15+
16+
jobs:
17+
docker:
18+
runs-on: ubuntu-22.04
19+
permissions:
20+
contents: read
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Set up QEMU
26+
uses: docker/setup-qemu-action@v3
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Log in to Docker Hub
32+
if: github.event_name != 'pull_request'
33+
uses: docker/login-action@v3
34+
with:
35+
username: ${{ secrets.DOCKERHUB_USERNAME }}
36+
password: ${{ secrets.DOCKERHUB_TOKEN }}
37+
38+
- name: Extract Docker metadata
39+
id: meta
40+
uses: docker/metadata-action@v5
41+
with:
42+
images: ${{ env.DOCKERHUB_IMAGE }}
43+
tags: |
44+
type=raw,value=latest,enable={{is_default_branch}}
45+
type=raw,value=test,enable=${{ github.ref == 'refs/heads/dev' }}
46+
type=ref,event=tag
47+
type=sha,prefix=sha-
48+
49+
- name: Build and push image
50+
uses: docker/build-push-action@v6
51+
with:
52+
context: .
53+
file: ./Dockerfile
54+
platforms: linux/amd64,linux/arm64
55+
push: ${{ github.event_name != 'pull_request' }}
56+
tags: ${{ steps.meta.outputs.tags }}
57+
labels: ${{ steps.meta.outputs.labels }}
58+

docker-compose.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
services:
22
app:
33
build: .
4+
# todo: change to phplist dockerhub
45
image: tatevikg1/phplist:test
56
container_name: base-distribution-app
67
ports:
7-
- "${PHPLIST_PORT:-8081}:80"
8+
- "${PHPLIST_PORT:-8081}:8081"
89
environment:
910
# Database connection (mirrors config/parameters.yml expectations)
1011
PHPLIST_DATABASE_NAME: phplistdb
@@ -13,9 +14,9 @@ services:
1314
PHPLIST_DATABASE_DRIVER: ${PHPLIST_DATABASE_DRIVER:-pdo_mysql} # pdo_pgsql
1415
PHPLIST_DATABASE_HOST: ${PHPLIST_DATABASE_HOST:-db} # postgres
1516
PHPLIST_DATABASE_PORT: ${PHPLIST_DATABASE_PORT:-3306} # 5432
16-
REST_API_BASE_URL: 'http://app/'
17-
FRONT_END_BASE_URL: 'http://app/'
18-
API_BASE_URL: 'http://app/'
17+
REST_API_BASE_URL: 'http://app:8081/'
18+
FRONT_END_BASE_URL: 'http://app:8081/'
19+
API_BASE_URL: 'http://app:8081/'
1920

2021
# Symfony environment
2122
APP_ENV: prod
@@ -25,6 +26,9 @@ services:
2526
volumes:
2627
- ./var/logs:/var/www/html/var/log
2728
- ./var/cache:/var/www/html/var/cache
29+
- ./docker/apache/servername.conf:/etc/apache2/conf-enabled/servername.conf:ro
30+
- ./docker/apache/ports.conf:/etc/apache2/ports.conf:ro
31+
- ./docker/apache/000-default.conf:/etc/apache2/sites-available/000-default.conf:ro
2832
networks: [ appnet ]
2933

3034
command: >

docker/apache/000-default.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<VirtualHost *:8081>
2+
ServerName app
3+
DocumentRoot /var/www/html/public
4+
5+
<Directory /var/www/html/public>
6+
AllowOverride All
7+
Require all granted
8+
</Directory>
9+
10+
ErrorLog ${APACHE_LOG_DIR}/error.log
11+
CustomLog ${APACHE_LOG_DIR}/access.log combined
12+
</VirtualHost>

docker/apache/ports.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Listen 8081

docker/apache/servername.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ServerName app

0 commit comments

Comments
 (0)