Skip to content

Commit

Permalink
Added worker
Browse files Browse the repository at this point in the history
  • Loading branch information
rennokki committed Apr 12, 2021
1 parent 1efd2d1 commit 4a20910
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .github/workflows/docker-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,34 @@ jobs:
context: .
tags: renokico/laravel-helm-demo:octane-${{ github.sha }}
file: Dockerfile.octane

worker_push:
if: "!contains(github.event.head_commit.message, 'skip ci')"

runs-on: ubuntu-latest

name: Tag Commit (Worker)

steps:
- uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker
uses: docker/build-push-action@v2
with:
push: true
context: .
tags: renokico/laravel-helm-demo:worker-${{ github.sha }}
file: Dockerfile.worker
32 changes: 32 additions & 0 deletions .github/workflows/docker-latest-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,35 @@ jobs:
tags: renokico/laravel-helm-demo:octane-latest
labels: ${{ steps.docker_meta.outputs.labels }}
file: Dockerfile.octane

push_worker:
if: "!contains(github.event.head_commit.message, 'skip ci')"

runs-on: ubuntu-latest

name: Tag Latest (Worker)

steps:
- uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker
uses: docker/build-push-action@v2
with:
push: true
context: .
tags: renokico/laravel-helm-demo:worker-latest
labels: ${{ steps.docker_meta.outputs.labels }}
file: Dockerfile.worker
60 changes: 59 additions & 1 deletion .github/workflows/docker-release-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,62 @@ jobs:
context: .
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
file: Dockerfile.fpm
file: Dockerfile.octane

push_worker:
if: "!contains(github.event.head_commit.message, 'skip ci')"

runs-on: ubuntu-latest

name: Tag Release (Worker)

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions: dom, curl, intl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
coverage: pcov

- uses: actions/cache@v2.1.4
name: Cache Composer dependencies
with:
path: ~/.composer/cache/files
key: composer-${{ hashFiles('composer.json') }}

- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v2.3.0
with:
images: renokico/laravel-helm-demo
tags: |
type=semver,pattern=worker-{{version}}
type=semver,pattern=worker-{{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Install dependencies
run: |
composer install --no-interaction --no-progress --prefer-dist --optimize-autoloader --no-dev
- name: Build and Push
id: docker
uses: docker/build-push-action@v2
with:
push: true
context: .
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
file: Dockerfile.worker
55 changes: 55 additions & 0 deletions Dockerfile.worker
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM php:8.0-cli-alpine

RUN apk --update add \
wget \
curl \
build-base \
composer \
nodejs-current \
nodejs-current-npm \
libmcrypt-dev \
libxml2-dev \
pcre-dev \
zlib-dev \
autoconf \
oniguruma-dev \
openssl \
openssl-dev \
freetype-dev \
libjpeg-turbo-dev \
jpeg-dev \
libpng-dev \
imagemagick-dev \
imagemagick \
postgresql-dev \
libzip-dev \
gettext-dev \
libxslt-dev \
libgcrypt-dev && \
pecl channel-update pecl.php.net && \
pecl install mcrypt redis-5.3.4 && \
docker-php-ext-install \
mysqli \
mbstring \
pdo \
pdo_mysql \
tokenizer \
xml \
pcntl \
bcmath \
pdo_pgsql \
zip \
intl \
gettext \
soap \
sockets \
xsl && \
docker-php-ext-configure gd --with-freetype=/usr/lib/ --with-jpeg=/usr/lib/ && \
docker-php-ext-install gd && \
docker-php-ext-enable redis && \
rm -rf /tmp/pear && \
rm /var/cache/apk/*

COPY . /var/www

ENTRYPOINT ["php", "-v"]
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- [Change deployment steps](#change-deployment-steps)
- [Change PHP-FPM version](#change-php-fpm-version)
- [Change Octane version](#change-octane-version)
- [Workers](#workers)
- [Deploying](#deploying)
- [Helm v3](#helm-v3)
- [Autoscaling](#autoscaling)
Expand Down Expand Up @@ -41,6 +42,10 @@ the final image will contain the project with dependencies installed, as long as

The project contains an Octane-based image. Same as with the PHP-FPM version, you can change the Octane-based image by editing `Dockerfile.octane`.

### Workers

The project contains an PHP CLI-based image that you can use to run your Laravel workers, such as queues or schedulers. To change the image, edit `Dockerfile.worker`.

## Deploying

### Helm v3
Expand Down

0 comments on commit 4a20910

Please sign in to comment.