Switch to building docker containers with buildx and build arm64 version, fixes #84 #179

Merged
mwalbeck merged 2 commits from arm64-builds into master 2021-07-06 23:33:03 +00:00
5 changed files with 12 additions and 342 deletions

View File

@ -1,12 +1,8 @@
def main(ctx): def main(ctx):
return [ return [
lint(), lint(),
default_tests("1.6", "1.6"),
default_tests("1.6-prod", "1.6", "Dockerfile.prod"),
default_tests("1.7", "1.7"), default_tests("1.7", "1.7"),
default_tests("1.7-prod", "1.7", "Dockerfile.prod"), default_tests("1.7-prod", "1.7", "Dockerfile.prod"),
release("1.6", "1.6"),
release("1.6-prod", "1.6", "Dockerfile.prod", "prod"),
release("1.7", "1.7", custom_tags="latest"), release("1.7", "1.7", custom_tags="latest"),
release("1.7-prod", "1.7", "Dockerfile.prod", "prod", "latest-prod") release("1.7-prod", "1.7", "Dockerfile.prod", "prod", "latest-prod")
] ]
@ -69,11 +65,12 @@ def default_tests(name, grav_version, dockerfile="Dockerfile"):
"steps": [ "steps": [
{ {
"name": "build test", "name": "build test",
"image": "plugins/docker", "image": "thegeeklab/drone-docker-buildx",
"pull": "if-not-exists", "pull": "if-not-exists",
"settings": { "settings": {
"dockerfile": "%s/%s" % (grav_version, dockerfile), "dockerfile": "%s/%s" % (grav_version, dockerfile),
"dry_run": "true", "dry_run": "true",
"platforms": "linux/amd64,linux/arm64",
"repo": "mwalbeck/getgrav" "repo": "mwalbeck/getgrav"
}, },
} }
@ -109,7 +106,7 @@ def release(name, grav_version, dockerfile="Dockerfile", app_env="", custom_tags
}, },
{ {
"name": "build and publish", "name": "build and publish",
"image": "plugins/docker", "image": "thegeeklab/drone-docker-buildx",
"pull": "if-not-exists", "pull": "if-not-exists",
"settings": { "settings": {
"dockerfile": "%s/%s" % (grav_version, dockerfile), "dockerfile": "%s/%s" % (grav_version, dockerfile),
@ -119,6 +116,7 @@ def release(name, grav_version, dockerfile="Dockerfile", app_env="", custom_tags
"password": { "password": {
"from_secret": "dockerhub_password" "from_secret": "dockerhub_password"
}, },
"platforms": "linux/amd64,linux/arm64",
"repo": "mwalbeck/getgrav" "repo": "mwalbeck/getgrav"
}, },
}, },

View File

@ -38,56 +38,6 @@ trigger:
exclude: exclude:
- refs/heads/renovate/* - refs/heads/renovate/*
---
kind: pipeline
type: docker
name: default_tests_1.6
platform:
os: linux
arch: amd64
steps:
- name: build test
pull: if-not-exists
image: plugins/docker
settings:
dockerfile: 1.6/Dockerfile
dry_run: true
repo: mwalbeck/getgrav
trigger:
event:
- pull_request
depends_on:
- lint
---
kind: pipeline
type: docker
name: default_tests_1.6-prod
platform:
os: linux
arch: amd64
steps:
- name: build test
pull: if-not-exists
image: plugins/docker
settings:
dockerfile: 1.6/Dockerfile.prod
dry_run: true
repo: mwalbeck/getgrav
trigger:
event:
- pull_request
depends_on:
- lint
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
@ -100,10 +50,11 @@ platform:
steps: steps:
- name: build test - name: build test
pull: if-not-exists pull: if-not-exists
image: plugins/docker image: thegeeklab/drone-docker-buildx
settings: settings:
dockerfile: 1.7/Dockerfile dockerfile: 1.7/Dockerfile
dry_run: true dry_run: true
platforms: linux/amd64,linux/arm64
repo: mwalbeck/getgrav repo: mwalbeck/getgrav
trigger: trigger:
@ -125,10 +76,11 @@ platform:
steps: steps:
- name: build test - name: build test
pull: if-not-exists pull: if-not-exists
image: plugins/docker image: thegeeklab/drone-docker-buildx
settings: settings:
dockerfile: 1.7/Dockerfile.prod dockerfile: 1.7/Dockerfile.prod
dry_run: true dry_run: true
platforms: linux/amd64,linux/arm64
repo: mwalbeck/getgrav repo: mwalbeck/getgrav
trigger: trigger:
@ -138,117 +90,6 @@ trigger:
depends_on: depends_on:
- lint - lint
---
kind: pipeline
type: docker
name: release_1.6
platform:
os: linux
arch: amd64
steps:
- name: determine tags
pull: if-not-exists
image: mwalbeck/determine-docker-tags:latest-distroless
environment:
APP_NAME: GRAV
DOCKERFILE_PATH: 1.6/Dockerfile
INCLUDE_MAJOR: negative
VERSION_TYPE: docker_env
- name: build and publish
pull: if-not-exists
image: plugins/docker
settings:
dockerfile: 1.6/Dockerfile
password:
from_secret: dockerhub_password
repo: mwalbeck/getgrav
username:
from_secret: dockerhub_username
- name: notify
pull: if-not-exists
image: plugins/matrix
settings:
homeserver: https://matrix.mwalbeck.org
password:
from_secret: matrix_password
roomid:
from_secret: matrix_roomid
username:
from_secret: matrix_username
when:
status:
- failure
- success
trigger:
branch:
- master
event:
- push
depends_on:
- lint
---
kind: pipeline
type: docker
name: release_1.6-prod
platform:
os: linux
arch: amd64
steps:
- name: determine tags
pull: if-not-exists
image: mwalbeck/determine-docker-tags:latest-distroless
environment:
APP_ENV: prod
APP_NAME: GRAV
DOCKERFILE_PATH: 1.6/Dockerfile.prod
INCLUDE_MAJOR: negative
VERSION_TYPE: docker_env
- name: build and publish
pull: if-not-exists
image: plugins/docker
settings:
dockerfile: 1.6/Dockerfile.prod
password:
from_secret: dockerhub_password
repo: mwalbeck/getgrav
username:
from_secret: dockerhub_username
- name: notify
pull: if-not-exists
image: plugins/matrix
settings:
homeserver: https://matrix.mwalbeck.org
password:
from_secret: matrix_password
roomid:
from_secret: matrix_roomid
username:
from_secret: matrix_username
when:
status:
- failure
- success
trigger:
branch:
- master
event:
- push
depends_on:
- lint
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
@ -271,11 +112,12 @@ steps:
- name: build and publish - name: build and publish
pull: if-not-exists pull: if-not-exists
image: plugins/docker image: thegeeklab/drone-docker-buildx
settings: settings:
dockerfile: 1.7/Dockerfile dockerfile: 1.7/Dockerfile
password: password:
from_secret: dockerhub_password from_secret: dockerhub_password
platforms: linux/amd64,linux/arm64
repo: mwalbeck/getgrav repo: mwalbeck/getgrav
username: username:
from_secret: dockerhub_username from_secret: dockerhub_username
@ -328,11 +170,12 @@ steps:
- name: build and publish - name: build and publish
pull: if-not-exists pull: if-not-exists
image: plugins/docker image: thegeeklab/drone-docker-buildx
settings: settings:
dockerfile: 1.7/Dockerfile.prod dockerfile: 1.7/Dockerfile.prod
password: password:
from_secret: dockerhub_password from_secret: dockerhub_password
platforms: linux/amd64,linux/arm64
repo: mwalbeck/getgrav repo: mwalbeck/getgrav
username: username:
from_secret: dockerhub_username from_secret: dockerhub_username

View File

@ -1,84 +0,0 @@
FROM php:7.3.29-fpm-buster@sha256:9fa6acffa9b016b8090e9f20b225fc2d83183b58c49d0290038c7b0b07ecdea8
SHELL [ "/bin/bash", "-exo", "pipefail", "-c" ]
# renovate: datasource=github-tags depName=getgrav/grav versioning=semver
ENV GRAV_VERSION 1.6.31
# renovate: datasource=github-tags depName=krakjoe/apcu versioning=semver
ENV PHP_APCU_VERSION v5.1.20
# renovate: datasource=github-tags depName=php/pecl-file_formats-yaml versioning=semver
ENV PHP_YAML_VERSION 2.2.1
RUN groupadd --system foo; \
useradd --no-log-init --system --gid foo --create-home foo; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
git \
unzip \
rsync \
gosu \
##### Run dependencies
libzip4 \
libyaml-0-2 \
libpng16-16 \
libjpeg62-turbo \
libwebp6 \
libfreetype6 \
##### Build dependencies
libwebp-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
libyaml-dev \
libzip-dev \
; \
docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr; \
docker-php-ext-install -j "$(nproc)" \
zip \
gd \
opcache \
; \
pecl install apcu-${PHP_APCU_VERSION:1}; \
pecl install yaml-$PHP_YAML_VERSION; \
\
docker-php-ext-enable \
apcu \
yaml \
; \
apt-get purge -y --auto-remove \
libwebp-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
libyaml-dev \
libzip-dev \
; \
rm -rf /var/lib/apt/lists/*; \
\
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"; \
\
git clone --branch $GRAV_VERSION https://github.com/getgrav/grav.git /usr/share/grav; \
rm -rf \
/usr/share/grav/.editorconfig \
/usr/share/grav/.gitignore \
/usr/share/grav/.travis.yml \
/usr/share/grav/.git \
/usr/share/grav/assets \
/usr/share/grav/backup \
/usr/share/grav/cache \
/usr/share/grav/images \
/usr/share/grav/logs \
/usr/share/grav/tmp \
/usr/share/grav/tests \
/usr/share/grav/webserver-configs \
/usr/share/grav/user \
;
COPY entrypoint.sh /entrypoint.sh
COPY grav.ini $PHP_INI_DIR/conf.d/
EXPOSE 9000
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]

View File

@ -1,85 +0,0 @@
FROM php:7.3.29-fpm-buster@sha256:9fa6acffa9b016b8090e9f20b225fc2d83183b58c49d0290038c7b0b07ecdea8
SHELL [ "/bin/bash", "-exo", "pipefail", "-c" ]
# renovate: datasource=github-tags depName=getgrav/grav versioning=semver
ENV GRAV_VERSION 1.6.31
# renovate: datasource=github-tags depName=krakjoe/apcu versioning=semver
ENV PHP_APCU_VERSION v5.1.20
# renovate: datasource=github-tags depName=php/pecl-file_formats-yaml versioning=semver
ENV PHP_YAML_VERSION 2.2.1
RUN groupadd --force --system --gid 33 www-data; \
useradd --no-log-init --system --gid www-data --no-create-home --uid 33 www-data || true; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
git \
unzip \
rsync \
gosu \
##### Run dependencies
libzip4 \
libyaml-0-2 \
libpng16-16 \
libjpeg62-turbo \
libwebp6 \
libfreetype6 \
##### Build dependencies
libwebp-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
libyaml-dev \
libzip-dev \
; \
docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr; \
docker-php-ext-install -j "$(nproc)" \
zip \
gd \
opcache \
; \
pecl install apcu-${PHP_APCU_VERSION:1}; \
pecl install yaml-$PHP_YAML_VERSION; \
\
docker-php-ext-enable \
apcu \
yaml \
; \
apt-get purge -y --auto-remove \
libwebp-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
libyaml-dev \
libzip-dev \
; \
rm -rf /var/lib/apt/lists/*; \
\
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"; \
\
git clone --branch $GRAV_VERSION https://github.com/getgrav/grav.git /usr/share/grav; \
rm -rf \
/usr/share/grav/.editorconfig \
/usr/share/grav/.gitignore \
/usr/share/grav/.travis.yml \
/usr/share/grav/.git \
/usr/share/grav/assets \
/usr/share/grav/backup \
/usr/share/grav/cache \
/usr/share/grav/images \
/usr/share/grav/logs \
/usr/share/grav/tmp \
/usr/share/grav/tests \
/usr/share/grav/webserver-configs \
/usr/share/grav/user \
;
COPY entrypoint.prod.sh /entrypoint.sh
COPY grav.ini $PHP_INI_DIR/conf.d/
VOLUME [ "/var/www", "/tmp" ]
EXPOSE 9000
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]

View File

@ -11,8 +11,6 @@ You can find the image on Docker Hub and the source code can be found [here](htt
* latest, 1.7, 1.7.* * latest, 1.7, 1.7.*
* latest-prod, 1.7-prod, 1.7.*-prod * latest-prod, 1.7-prod, 1.7.*-prod
* 1.6, 1.6.*
* 1.6-prod, 1.6.*-prod
## Usage ## Usage