Build image action
Some checks failed
linter / quality (push) Successful in 3m11s
tests / ci (push) Successful in 11m59s
Build & Push Docker Image to Registry / build (release) Has been cancelled

This commit is contained in:
Javier Feliz 2025-07-16 18:38:20 -04:00
parent e5a1786842
commit 38108efd9d
9 changed files with 38 additions and 175 deletions

33
.github/workflows/build.yml vendored Normal file
View File

@ -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 }}

4
Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM gitgud.foo/thegrind/laravel-base:latest
# Get the app in there
COPY . /app

View File

@ -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:

View File

@ -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

View File

@ -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"]

View File

@ -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"]

View File

@ -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

View File

@ -1,15 +0,0 @@
<?php
use App\Models\User;
uses(\Illuminate\Foundation\Testing\RefreshDatabase::class);
test('guests are redirected to the login page', function () {
$this->get('/dashboard')->assertRedirect('/login');
});
test('authenticated users can visit the dashboard', function () {
$this->actingAs($user = User::factory()->create());
$this->get('/dashboard')->assertStatus(200);
});

View File

@ -1,7 +0,0 @@
<?php
it('returns a successful response', function () {
$response = $this->get('/');
$response->assertStatus(200);
});