From 5ce05d06805eff0cae36ae83afd2c33309fe107b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Preu=C3=9F?= Date: Sun, 5 Dec 2021 14:36:21 +0100 Subject: [PATCH] Update docs and jobs --- .github/workflows/laravel.yml | 32 ++++++++++++++++++------- README.md | 33 ++++++++++++++++++++++++-- runtimes/laravel:8.1-octane/Dockerfile | 20 ++++++++++++++++ 3 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 runtimes/laravel:8.1-octane/Dockerfile diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index 77c73de..b49d4ce 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -1,8 +1,12 @@ -on: push +on: [push, pull_request] name: Build jobs: - deploy: - name: Build Laravel Images + build: + strategy: + fail-fast: false + matrix: + runtime: [ laravel:8.0-octane, laravel:8.1-octane ] + name: "bpkg.io/${{ matrix.runtime }}" runs-on: ubuntu-latest steps: - uses: actions/checkout@master @@ -16,17 +20,27 @@ jobs: registry: bpkg.io username: k3s password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and push bpkg.io/laravel:8.0-octane + - name: Build and push bpkg.io/${{ matrix.runtime }} + if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v2 with: context: . - file: ./runtimes/laravel:8.0-octane/Dockerfile + file: ./runtimes/${{ matrix.runtime }}/Dockerfile platforms: | linux/amd64 linux/arm/v7 push: true - build-args: | - CICD_GIT_COMMIT=${{ steps.slug.outputs.sha8 }} tags: | - bpkg.io/laravel:latest - bpkg.io/laravel:8.0-octane + bpkg.io/${{ matrix.runtime }} + - name: Build and push bpkg.io/${{ matrix.runtime }}-develop + if: github.ref == 'refs/heads/develop' + uses: docker/build-push-action@v2 + with: + context: . + file: ./runtimes/${{ matrix.runtime }}/Dockerfile + platforms: | + linux/amd64 + linux/arm/v7 + push: true + tags: | + bpkg.io/${{ matrix.runtime }}-develop diff --git a/README.md b/README.md index 364cd5c..ecc8c9b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,31 @@ -# bpkg-laravel -bpkg.io/laravel +# bpkg.io Images + +The bkg.io images are a collection of images that are used as a base for building other images. Mostly they are used as +base images for our web projects. + +## Supported Images + +| Image | Version | Description | Architecture | Supported | +| ------ | ------- | ----------- | ------------ | ---------- | +| bpkg.io/laravel | 8.0-octane | PHP image containing all extensions for a laravel octane app. | amd64, arm64 | yes | +| bpkg.io/laravel | 8.0-octane-develop | Development build. | amd64, arm64 | no | +| bpkg.io/laravel | 8.1-octane | PHP image containing all extensions for a laravel octane app. | amd64, arm64 | yes | +| bpkg.io/laravel | 8.1-octane-develop | Development build. | amd64, arm64 | no | + +## Concepts + +### Default Working Directory + +For web projects the default working directory is `/var/www/html`. This applies to all `bpkg.io/laravel` images. + +## Usage + +The following dockerfile show the usage of the bpkg.io/laravel image. Per default, it uses the +command `php artisan octane:start --host 0.0.0.0` to start the application and expose the application on port 8000. + +```dockerfile +FROM bpkg.io/laravel:8.0-octane + +# copy all your project files to the /var/www/html folder +COPY . /var/www/html +``` \ No newline at end of file diff --git a/runtimes/laravel:8.1-octane/Dockerfile b/runtimes/laravel:8.1-octane/Dockerfile new file mode 100644 index 0000000..0ee9030 --- /dev/null +++ b/runtimes/laravel:8.1-octane/Dockerfile @@ -0,0 +1,20 @@ +FROM php:8.1-cli-alpine3.15 + +WORKDIR /var/www/html + +# STSTEM: Install required packages +RUN apk --no-cache upgrade && \ + apk --no-cache add bash git sudo openssh libxml2-dev postgresql-dev oniguruma-dev autoconf gcc g++ make npm freetype-dev libjpeg-turbo-dev libpng-dev libzip-dev + +# COMPOSER: install binary and prestissimo +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer + +# PHP: install extensions +RUN pecl channel-update pecl.php.net +RUN pecl install ssh2 swoole +RUN docker-php-ext-configure gd --with-freetype --with-jpeg +RUN docker-php-ext-install mbstring xml pcntl gd zip sockets pdo pdo_pgsql pdo_mysql bcmath +RUN docker-php-ext-enable mbstring xml gd zip swoole pcntl sockets bcmath pdo pdo_pgsql pdo_mysql + +EXPOSE 8000 +CMD ["php","artisan","octane:start", "--host=0.0.0.0"]