From d73d0234e160eebf76958544307c7cee7fdd8eb9 Mon Sep 17 00:00:00 2001 From: Javier Feliz Date: Wed, 16 Jul 2025 12:14:43 -0400 Subject: [PATCH] Initial commit --- .env.docker | 39 +++++++++++++++++++++++++++++++++++++ .github/workflows/build.yml | 26 +++++++++++++++++++++++++ Dockerfile | 22 +++++++++++++++++++++ entrypoint.sh | 18 +++++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 .env.docker create mode 100644 .github/workflows/build.yml create mode 100644 Dockerfile create mode 100644 entrypoint.sh diff --git a/.env.docker b/.env.docker new file mode 100644 index 0000000..8dc3ed5 --- /dev/null +++ b/.env.docker @@ -0,0 +1,39 @@ +APP_NAME=FlowTODO +APP_ENV=production +APP_KEY= +APP_TIMEZONE="America/New_York" + +APP_LOCALE=en +APP_FALLBACK_LOCALE=en +APP_FAKER_LOCALE=en_US + +APP_MAINTENANCE_DRIVER=file +# APP_MAINTENANCE_STORE=database + +PHP_CLI_SERVER_WORKERS=4 + +BCRYPT_ROUNDS=12 + +LOG_CHANNEL=stack +LOG_STACK=single +LOG_DEPRECATIONS_CHANNEL=null +LOG_LEVEL=debug + +DB_CONNECTION=sqlite + +SESSION_DRIVER=database +SESSION_LIFETIME=120 +SESSION_ENCRYPT=false +SESSION_PATH=/ +SESSION_DOMAIN=null + +BROADCAST_CONNECTION=log +FILESYSTEM_DISK=local +QUEUE_CONNECTION=database + +CACHE_STORE=database +# CACHE_PREFIX=flowtodo + +MEMCACHED_HOST=127.0.0.1 + +OCTANE_SERVER=frankenphp diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..603beed --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,26 @@ +name: Build & Push Docker Image to Registry + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: | + gitgud.foo/thegrind/laravel-base:latest + gitgud.foo/thegrind/laravel-base:${{ github.event.release.tag_name }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3138b29 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM dunglas/frankenphp + +RUN install-php-extensions \ + pcntl \ + pdo \ + pdo_pgsql \ + pdo_mysql \ + pdo_sqlite + +# Add other PHP extensions here... + +# Get the app in there +COPY . /app + +# Set up entrypoint script +COPY ./docker/entrypoint.sh /usr/local/bin/entrypoint.sh +COPY ./docker/.env.docker /app/.env +RUN chmod +x /usr/local/bin/entrypoint.sh + +RUN touch /app/database/database.sqlite && chmod 777 /app/database/database.sqlite + +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..868f417 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/sh +set -e + +php /app/artisan migrate --force +php /app/artisan storage:link + +# Generate only if no key is set in env or config +if [ -z "$APP_KEY" ]; then + echo "Generating APP_KEY..." + php /app/artisan key:generate --force +fi + +php /app/artisan config:clear +php /app/artisan config:cache +php /app/artisan view:cache + +# exec php /app/artisan octane:frankenphp +exec php /app/artisan octane:start --server=frankenphp --host=0.0.0.0 --admin-port=2019 --port=8000