Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ database/*.sqlite*
!.env.example
tests
*.md
public/build
public/hot
bootstrap/ssr
playwright-report
test-results
storage/e2e
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="registry@fleetbase.local"
MAIL_FROM_NAME="${APP_NAME}"

# Sign in with GitHub (an OAuth app). Leave the id and secret empty to hide the button.
# The callback defaults to ${APP_URL}/auth/github/callback.
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_REDIRECT_URI=

# Package store. Local disk by default; S3 / MinIO in docker and production.
FILESYSTEM_DISK=local
REGISTRY_STORAGE_DISK=local
Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,90 @@ jobs:
cat storage/logs/serve.log || true
cat storage/logs/laravel.log || true

website:
name: Website (lint, Vitest, build)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm

- name: Install dependencies
run: npm ci --no-audit --no-fund

- name: Lint (ESLint)
run: npm run lint

- name: Vitest
run: npm test

- name: Build (client and SSR)
run: npm run build

- name: Upload build
uses: actions/upload-artifact@v4
with:
name: website-build
path: |
public/build
bootstrap/ssr
retention-days: 3

website-e2e:
name: Website smoke test (Playwright)
runs-on: ubuntu-latest
needs: [tests, website]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
extensions: mbstring, intl, bcmath, gd, zip, pdo_sqlite, sqlite3, phar, zlib
coverage: none
tools: composer:v2

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm

- name: Install dependencies
run: |
composer install --no-interaction --prefer-dist --no-progress
npm ci --no-audit --no-fund
npx playwright install --with-deps chromium

# The artifact keeps paths from the repository root: public/build and bootstrap/ssr. With
# the SSR bundle present, scripts/e2e-server.sh also runs the renderer.
- name: Download the website build
uses: actions/download-artifact@v4
with:
name: website-build
path: .

- name: Run the smoke test
run: CI=true npx playwright test

- name: Playwright report
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: |
playwright-report
test-results
storage/logs
retention-days: 7

docker:
name: Docker image builds
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ Homestead.json
Homestead.yaml
Thumbs.db
/database/*.sqlite*
/bootstrap/ssr
/playwright-report
/test-results
/storage/e2e
20 changes: 19 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ COPY composer.json composer.lock ./
RUN --mount=type=cache,target=/tmp/cache \
composer install --no-dev --no-interaction --no-scripts --prefer-dist --no-progress --ignore-platform-reqs

# ---- Website assets ---------------------------------------------------------
# Vite builds the Inertia (React) client into public/build and the server-side renderer into
# bootstrap/ssr (one self-contained file; the runtime runs it with Node, no node_modules).
FROM node:22-bookworm-slim AS assets
WORKDIR /app
COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm \
npm ci --no-audit --no-fund
COPY vite.config.js ./
COPY resources ./resources
RUN npm run build

# ---- Runtime ---------------------------------------------------------------
FROM serversideup/php:8.3-fpm-nginx-alpine AS base

Expand All @@ -27,11 +39,17 @@ ENV PHP_OPCACHE_ENABLE=1 \

USER root
RUN install-php-extensions bcmath intl gd zip pdo_mysql redis pcntl exif \
&& apk add --no-cache mysql-client
&& apk add --no-cache mysql-client nodejs

# Inertia SSR as an s6 service beside nginx and php-fpm (docker/s6/inertia-ssr/run).
COPY --chmod=755 docker/s6/inertia-ssr /etc/s6-overlay/s6-rc.d/inertia-ssr
RUN touch /etc/s6-overlay/user-bundles.d/user/contents.d/inertia-ssr

WORKDIR /var/www/html
COPY --chown=www-data:www-data . .
COPY --from=vendor --chown=www-data:www-data /app/vendor ./vendor
COPY --from=assets --chown=www-data:www-data /app/public/build ./public/build
COPY --from=assets --chown=www-data:www-data /app/bootstrap/ssr ./bootstrap/ssr

RUN composer dump-autoload --optimize --classmap-authoritative --no-dev 2>/dev/null || true \
&& mkdir -p storage/framework/{cache,sessions,views} storage/logs bootstrap/cache \
Expand Down
Loading
Loading