From 1f0022b6e179f2cda0ab860a9e95d05056e4b5c2 Mon Sep 17 00:00:00 2001 From: xgaia Date: Fri, 28 Jan 2022 17:23:51 +0100 Subject: [PATCH] ci: dockerize and push with gh-actions --- .github/workflows/docker.yaml | 54 +++++++++++++++++++++++++++++++++++ Dockerfile | 18 ++++++++++++ apache.conf | 22 ++++++++++++++ php.ini | 3 ++ 4 files changed, 97 insertions(+) create mode 100644 .github/workflows/docker.yaml create mode 100644 Dockerfile create mode 100644 apache.conf create mode 100644 php.ini diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000..01dfee8 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,54 @@ +name: Docker publish + +on: + push: + branches: + - 'master' + tags: + - '*.*.*' + +jobs: + docker: + environment: docker-registry + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + # list of Docker images to use as base name for tags + images: registry.hub.docker.com/${{ secrets.DOCKER_REGISTRY_USERNAME }}/signaturepdf + # generate Docker tags based on the following events/attributes + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to registry + uses: docker/login-action@v1 + with: + registry: registry.hub.docker.com + username: xgaia + password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + secrets: | + GIT_AUTH_TOKEN=${{ secrets.DOCKER_REGISTRY_TOKEN }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0435aee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM php:7.4-apache + +ENV SERVERNAME=localhost + +RUN apt update && apt install -y gettext-base librsvg2-bin pdftk imagemagick potrace + +COPY . /usr/local/signaturepdf + +RUN chown -R www-data:www-data /usr/local/signaturepdf && chmod 750 -R /usr/local/signaturepdf && \ + cp /usr/local/signaturepdf/php.ini /usr/local/etc/php/conf.d/uploads.ini && \ + cat /usr/local/signaturepdf/apache.conf | envsubst > /etc/apache2/sites-available/signaturepdf.conf && \ + a2enmod rewrite && a2ensite signaturepdf + +WORKDIR /usr/local/signaturepdf + +CMD envsubst < /usr/local/signaturepdf/apache.conf > /etc/apache2/sites-available/signaturepdf.conf && \ + chown -R www-data:www-data /usr/local/signaturepdf && chmod 750 -R /usr/local/signaturepdf && \ + apache2-foreground diff --git a/apache.conf b/apache.conf new file mode 100644 index 0000000..3a077d0 --- /dev/null +++ b/apache.conf @@ -0,0 +1,22 @@ + + ServerName ${SERVERNAME} + DocumentRoot /usr/local/signaturepdf/public + DirectoryIndex index.php + + AddDefaultCharset UTF-8 + + + AllowOverride All + = 2.3> + Require all granted + + + Order Deny,Allow + Allow from all + + + + LogLevel warn + ErrorLog /var/log/apache2/ssp_error.log + CustomLog /var/log/apache2/ssp_access.log combined + diff --git a/php.ini b/php.ini new file mode 100644 index 0000000..a0dfce0 --- /dev/null +++ b/php.ini @@ -0,0 +1,3 @@ +upload_max_filesize = 24M +post_max_size = 24M +max_file_uploads = 201