From 38108efd9d68f1503df9462a1d9442aa4a65739a Mon Sep 17 00:00:00 2001 From: Javier Feliz Date: Wed, 16 Jul 2025 18:38:20 -0400 Subject: [PATCH] Build image action --- .github/workflows/build.yml | 33 +++++++++++++++ Dockerfile | 4 ++ Makefile | 2 +- docker/.env.docker | 39 ------------------ docker/Dockerfile | 23 ----------- docker/Dockerfile.bak | 72 --------------------------------- docker/entrypoint.sh | 18 --------- tests/Feature/DashboardTest.php | 15 ------- tests/Feature/ExampleTest.php | 7 ---- 9 files changed, 38 insertions(+), 175 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 Dockerfile delete mode 100644 docker/.env.docker delete mode 100644 docker/Dockerfile delete mode 100644 docker/Dockerfile.bak delete mode 100644 docker/entrypoint.sh delete mode 100644 tests/Feature/DashboardTest.php delete mode 100644 tests/Feature/ExampleTest.php diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..868ade2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +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: Log in to Gitea Registry + uses: docker/login-action@v3 + with: + registry: gitgud.foo + username: docker_registry_pusher + password: ${{ secrets.DOCKER_USER_PASSWORD }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: | + gitgud.foo/thegrind/flowtodo:latest + gitgud.foo/thegrind/flowtodo:${{ github.event.release.tag_name }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4a66b30 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM gitgud.foo/thegrind/laravel-base:latest + +# Get the app in there +COPY . /app \ No newline at end of file diff --git a/Makefile b/Makefile index 040af21..adae006 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ VERSION = "latest" # Build the Docker image build: npm run build - docker build -t $(IMAGE_NAME) . -f docker/Dockerfile + docker build -t $(IMAGE_NAME) . # Run the container run: diff --git a/docker/.env.docker b/docker/.env.docker deleted file mode 100644 index 8dc3ed5..0000000 --- a/docker/.env.docker +++ /dev/null @@ -1,39 +0,0 @@ -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/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 8daa60f..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -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 ["php", "artisan", "octane:frankenphp"] -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] \ No newline at end of file diff --git a/docker/Dockerfile.bak b/docker/Dockerfile.bak deleted file mode 100644 index 4751051..0000000 --- a/docker/Dockerfile.bak +++ /dev/null @@ -1,72 +0,0 @@ -FROM ubuntu:24.04 - -LABEL maintainer="thegrind.dev" - -ARG WWWGROUP -ARG NODE_VERSION=22 -ARG MYSQL_CLIENT="mysql-client" -ARG POSTGRES_VERSION=17 - -RUN mkdir -p /app - -COPY . /app -RUN rm -rf /app/docker -WORKDIR /app - -ENV DEBIAN_FRONTEND=noninteractive -ENV TZ=UTC -ENV SUPERVISOR_PHP_COMMAND="/usr/bin/php -d variables_order=EGPCS /app/artisan serve --host=0.0.0.0 --port=80" -ENV SUPERVISOR_PHP_USER="sail" - -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone - -# RUN echo "Acquire::http::Pipeline-Depth 0;" >/etc/apt/apt.conf.d/99custom && -# echo "Acquire::http::No-Cache true;" >>/etc/apt/apt.conf.d/99custom && -# echo "Acquire::BrokenProxy true;" >>/etc/apt/apt.conf.d/99custom - -RUN apt-get update && apt-get upgrade -y \ - && mkdir -p /etc/apt/keyrings \ - && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python3 dnsutils librsvg2-bin fswatch ffmpeg nano \ - && curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xb8dc7e53946656efbce4c1dd71daeaab4ad4cab6' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \ - && echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \ - && apt-get update \ - && apt-get install -y php8.4-cli php8.4-dev \ - php8.4-pgsql php8.4-sqlite3 php8.4-gd \ - php8.4-curl php8.4-mongodb \ - php8.4-imap php8.4-mysql php8.4-mbstring \ - php8.4-xml php8.4-zip php8.4-bcmath php8.4-soap \ - php8.4-intl php8.4-readline \ - php8.4-ldap \ - php8.4-msgpack php8.4-igbinary php8.4-redis php8.4-swoole \ - php8.4-memcached php8.4-pcov php8.4-imagick php8.4-xdebug \ - && curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \ - && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ - && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \ - && apt-get update \ - && apt-get install -y nodejs \ - && npm install -g npm \ - && npm install -g pnpm \ - && npm install -g bun \ - && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null \ - && echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ - && curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg >/dev/null \ - && echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt noble-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ - && apt-get update \ - && apt-get install -y yarn \ - && apt-get install -y $MYSQL_CLIENT \ - && apt-get install -y postgresql-client-$POSTGRES_VERSION \ - && apt-get -y autoremove \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.4 - -# COPY start-container /usr/local/bin/start-container -# COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -# COPY php.ini /etc/php/8.4/cli/conf.d/99-sail.ini -# RUN chmod +x /usr/local/bin/start-container - -EXPOSE 80/tcp - -# CMD ["php", "/app/artisan", "--port", "80"] -CMD ["php", "/app/artisan", "serve", "--port=80", "--host=0.0.0.0"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh deleted file mode 100644 index 868f417..0000000 --- a/docker/entrypoint.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/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 diff --git a/tests/Feature/DashboardTest.php b/tests/Feature/DashboardTest.php deleted file mode 100644 index e5388af..0000000 --- a/tests/Feature/DashboardTest.php +++ /dev/null @@ -1,15 +0,0 @@ -get('/dashboard')->assertRedirect('/login'); -}); - -test('authenticated users can visit the dashboard', function () { - $this->actingAs($user = User::factory()->create()); - - $this->get('/dashboard')->assertStatus(200); -}); \ No newline at end of file diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php deleted file mode 100644 index 8b5843f..0000000 --- a/tests/Feature/ExampleTest.php +++ /dev/null @@ -1,7 +0,0 @@ -get('/'); - - $response->assertStatus(200); -});