Lint dockerfiles and add CI pipeline for linting #67
8 changed files with 93 additions and 49 deletions
62
.drone.yml
62
.drone.yml
|
@ -1,4 +1,35 @@
|
||||||
---
|
---
|
||||||
|
###############################################################################
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: lint
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Lint Dockerfiles
|
||||||
|
image: hadolint/hadolint
|
||||||
|
commands:
|
||||||
|
- hadolint */Dockerfile*
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- failure
|
||||||
|
- success
|
||||||
|
|
||||||
|
- name: Lint entrypoint scripts
|
||||||
|
image: koalaman/shellcheck-alpine
|
||||||
|
commands:
|
||||||
|
- shellcheck entrypoint*.sh
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- failure
|
||||||
|
- success
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- pull_request
|
||||||
|
- push
|
||||||
|
|
||||||
|
---
|
||||||
|
###############################################################################
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: test_1.6
|
name: test_1.6
|
||||||
|
@ -15,7 +46,11 @@ trigger:
|
||||||
event:
|
event:
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
|
|
||||||
---
|
---
|
||||||
|
###############################################################################
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: build_and_release_1.6
|
name: build_and_release_1.6
|
||||||
|
@ -62,7 +97,11 @@ trigger:
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
|
|
||||||
---
|
---
|
||||||
|
###############################################################################
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: test_1.6-prod
|
name: test_1.6-prod
|
||||||
|
@ -79,7 +118,11 @@ trigger:
|
||||||
event:
|
event:
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
|
|
||||||
---
|
---
|
||||||
|
###############################################################################
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: build_and_release_1.6-prod
|
name: build_and_release_1.6-prod
|
||||||
|
@ -126,7 +169,11 @@ trigger:
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
|
|
||||||
---
|
---
|
||||||
|
###############################################################################
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: test_1.7
|
name: test_1.7
|
||||||
|
@ -143,7 +190,11 @@ trigger:
|
||||||
event:
|
event:
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
|
|
||||||
---
|
---
|
||||||
|
###############################################################################
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: build_and_release_1.7
|
name: build_and_release_1.7
|
||||||
|
@ -190,7 +241,11 @@ trigger:
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
|
|
||||||
---
|
---
|
||||||
|
###############################################################################
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: test_1.7-prod
|
name: test_1.7-prod
|
||||||
|
@ -207,7 +262,11 @@ trigger:
|
||||||
event:
|
event:
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
|
|
||||||
---
|
---
|
||||||
|
###############################################################################
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: build_and_release_1.7-prod
|
name: build_and_release_1.7-prod
|
||||||
|
@ -253,3 +312,6 @@ trigger:
|
||||||
- master
|
- master
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
|
|
6
.hadolint.yaml
Normal file
6
.hadolint.yaml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
ignored:
|
||||||
|
- DL3008
|
||||||
|
- DL3003
|
||||||
|
- SC2164
|
||||||
|
- SC2086
|
|
@ -1,6 +1,6 @@
|
||||||
FROM php:7.3.26-fpm-buster@sha256:6bc677764c7f94da7c93a45e2831a6c1774001ff61e822011844fd79ae07b533
|
FROM php:7.3.26-fpm-buster@sha256:6bc677764c7f94da7c93a45e2831a6c1774001ff61e822011844fd79ae07b533
|
||||||
|
|
||||||
SHELL [ "/bin/bash", "-c" ]
|
SHELL [ "/bin/bash", "-exo", "pipefail", "-c" ]
|
||||||
|
|
||||||
# renovate: datasource=github-tags depName=getgrav/grav versioning=semver
|
# renovate: datasource=github-tags depName=getgrav/grav versioning=semver
|
||||||
ENV GRAV_VERSION 1.6.31
|
ENV GRAV_VERSION 1.6.31
|
||||||
|
@ -9,9 +9,7 @@ ENV PHP_APCU_VERSION v5.1.19
|
||||||
# renovate: datasource=github-tags depName=php/pecl-file_formats-yaml versioning=semver
|
# renovate: datasource=github-tags depName=php/pecl-file_formats-yaml versioning=semver
|
||||||
ENV PHP_YAML_VERSION 2.2.1
|
ENV PHP_YAML_VERSION 2.2.1
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN groupadd --system foo; \
|
||||||
\
|
|
||||||
groupadd --system foo; \
|
|
||||||
useradd --no-log-init --system --gid foo --create-home foo; \
|
useradd --no-log-init --system --gid foo --create-home foo; \
|
||||||
\
|
\
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
|
@ -23,9 +21,7 @@ RUN set -ex; \
|
||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*;
|
rm -rf /var/lib/apt/lists/*;
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN savedAptMark="$(apt-mark showmanual)"; \
|
||||||
\
|
|
||||||
savedAptMark="$(apt-mark showmanual)"; \
|
|
||||||
\
|
\
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
@ -63,9 +59,7 @@ RUN set -ex; \
|
||||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN git clone --branch $GRAV_VERSION https://github.com/getgrav/grav.git /usr/share/grav; \
|
||||||
\
|
|
||||||
git clone --branch $GRAV_VERSION https://github.com/getgrav/grav.git /usr/share/grav; \
|
|
||||||
cd /usr/share/grav; \
|
cd /usr/share/grav; \
|
||||||
rm -rf \
|
rm -rf \
|
||||||
.editorconfig \
|
.editorconfig \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FROM php:7.3.26-fpm-buster@sha256:6bc677764c7f94da7c93a45e2831a6c1774001ff61e822011844fd79ae07b533
|
FROM php:7.3.26-fpm-buster@sha256:6bc677764c7f94da7c93a45e2831a6c1774001ff61e822011844fd79ae07b533
|
||||||
|
|
||||||
SHELL [ "/bin/bash", "-c" ]
|
SHELL [ "/bin/bash", "-exo", "pipefail", "-c" ]
|
||||||
|
|
||||||
# renovate: datasource=github-tags depName=getgrav/grav versioning=semver
|
# renovate: datasource=github-tags depName=getgrav/grav versioning=semver
|
||||||
ENV GRAV_VERSION 1.6.31
|
ENV GRAV_VERSION 1.6.31
|
||||||
|
@ -9,9 +9,7 @@ ENV PHP_APCU_VERSION v5.1.19
|
||||||
# renovate: datasource=github-tags depName=php/pecl-file_formats-yaml versioning=semver
|
# renovate: datasource=github-tags depName=php/pecl-file_formats-yaml versioning=semver
|
||||||
ENV PHP_YAML_VERSION 2.2.1
|
ENV PHP_YAML_VERSION 2.2.1
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN groupadd --force --system --gid 33 www-data; \
|
||||||
\
|
|
||||||
groupadd --force --system --gid 33 www-data; \
|
|
||||||
useradd --no-log-init --system --gid www-data --no-create-home --uid 33 www-data || true; \
|
useradd --no-log-init --system --gid www-data --no-create-home --uid 33 www-data || true; \
|
||||||
\
|
\
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
|
@ -23,9 +21,7 @@ RUN set -ex; \
|
||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*;
|
rm -rf /var/lib/apt/lists/*;
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN savedAptMark="$(apt-mark showmanual)"; \
|
||||||
\
|
|
||||||
savedAptMark="$(apt-mark showmanual)"; \
|
|
||||||
\
|
\
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
@ -63,9 +59,7 @@ RUN set -ex; \
|
||||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN git clone --branch $GRAV_VERSION https://github.com/getgrav/grav.git /usr/share/grav; \
|
||||||
\
|
|
||||||
git clone --branch $GRAV_VERSION https://github.com/getgrav/grav.git /usr/share/grav; \
|
|
||||||
cd /usr/share/grav; \
|
cd /usr/share/grav; \
|
||||||
rm -rf \
|
rm -rf \
|
||||||
.editorconfig \
|
.editorconfig \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FROM php:7.4.14-fpm-buster@sha256:e9efa237664ac68793c62a7eb202a0383cce7e82ac43fb7f71347c23f1b6d3c7
|
FROM php:7.4.14-fpm-buster@sha256:e9efa237664ac68793c62a7eb202a0383cce7e82ac43fb7f71347c23f1b6d3c7
|
||||||
|
|
||||||
SHELL [ "/bin/bash", "-c" ]
|
SHELL [ "/bin/bash", "-exo", "pipefail", "-c" ]
|
||||||
|
|
||||||
# renovate: datasource=github-tags depName=getgrav/grav versioning=semver
|
# renovate: datasource=github-tags depName=getgrav/grav versioning=semver
|
||||||
ENV GRAV_VERSION 1.7.5
|
ENV GRAV_VERSION 1.7.5
|
||||||
|
@ -9,9 +9,7 @@ ENV PHP_APCU_VERSION v5.1.19
|
||||||
# renovate: datasource=github-tags depName=php/pecl-file_formats-yaml versioning=semver
|
# renovate: datasource=github-tags depName=php/pecl-file_formats-yaml versioning=semver
|
||||||
ENV PHP_YAML_VERSION 2.2.1
|
ENV PHP_YAML_VERSION 2.2.1
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN groupadd --system foo; \
|
||||||
\
|
|
||||||
groupadd --system foo; \
|
|
||||||
useradd --no-log-init --system --gid foo --create-home foo; \
|
useradd --no-log-init --system --gid foo --create-home foo; \
|
||||||
\
|
\
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
|
@ -23,9 +21,7 @@ RUN set -ex; \
|
||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*;
|
rm -rf /var/lib/apt/lists/*;
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN savedAptMark="$(apt-mark showmanual)"; \
|
||||||
\
|
|
||||||
savedAptMark="$(apt-mark showmanual)"; \
|
|
||||||
\
|
\
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
@ -44,7 +40,7 @@ RUN set -ex; \
|
||||||
; \
|
; \
|
||||||
\
|
\
|
||||||
pecl install apcu-${PHP_APCU_VERSION:1}; \
|
pecl install apcu-${PHP_APCU_VERSION:1}; \
|
||||||
pecl install yaml-$PHP_YAML_VERSION; \
|
pecl install yaml $PHP_YAML_VERSION; \
|
||||||
\
|
\
|
||||||
docker-php-ext-enable \
|
docker-php-ext-enable \
|
||||||
apcu \
|
apcu \
|
||||||
|
@ -63,9 +59,7 @@ RUN set -ex; \
|
||||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN git clone --branch $GRAV_VERSION https://github.com/getgrav/grav.git /usr/share/grav; \
|
||||||
\
|
|
||||||
git clone --branch $GRAV_VERSION https://github.com/getgrav/grav.git /usr/share/grav; \
|
|
||||||
cd /usr/share/grav; \
|
cd /usr/share/grav; \
|
||||||
rm -rf \
|
rm -rf \
|
||||||
.editorconfig \
|
.editorconfig \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FROM php:7.4.14-fpm-buster@sha256:e9efa237664ac68793c62a7eb202a0383cce7e82ac43fb7f71347c23f1b6d3c7
|
FROM php:7.4.14-fpm-buster@sha256:e9efa237664ac68793c62a7eb202a0383cce7e82ac43fb7f71347c23f1b6d3c7
|
||||||
|
|
||||||
SHELL [ "/bin/bash", "-c" ]
|
SHELL [ "/bin/bash", "-exo", "pipefail", "-c" ]
|
||||||
|
|
||||||
# renovate: datasource=github-tags depName=getgrav/grav versioning=semver
|
# renovate: datasource=github-tags depName=getgrav/grav versioning=semver
|
||||||
ENV GRAV_VERSION 1.7.3
|
ENV GRAV_VERSION 1.7.3
|
||||||
|
@ -9,9 +9,7 @@ ENV PHP_APCU_VERSION v5.1.19
|
||||||
# renovate: datasource=github-tags depName=php/pecl-file_formats-yaml versioning=semver
|
# renovate: datasource=github-tags depName=php/pecl-file_formats-yaml versioning=semver
|
||||||
ENV PHP_YAML_VERSION 2.2.1
|
ENV PHP_YAML_VERSION 2.2.1
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN groupadd --force --system --gid 33 www-data; \
|
||||||
\
|
|
||||||
groupadd --force --system --gid 33 www-data; \
|
|
||||||
useradd --no-log-init --system --gid www-data --no-create-home --uid 33 www-data || true; \
|
useradd --no-log-init --system --gid www-data --no-create-home --uid 33 www-data || true; \
|
||||||
\
|
\
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
|
@ -23,9 +21,7 @@ RUN set -ex; \
|
||||||
; \
|
; \
|
||||||
rm -rf /var/lib/apt/lists/*;
|
rm -rf /var/lib/apt/lists/*;
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN savedAptMark="$(apt-mark showmanual)"; \
|
||||||
\
|
|
||||||
savedAptMark="$(apt-mark showmanual)"; \
|
|
||||||
\
|
\
|
||||||
apt-get update; \
|
apt-get update; \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
@ -63,9 +59,7 @@ RUN set -ex; \
|
||||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN git clone --branch $GRAV_VERSION https://github.com/getgrav/grav.git /usr/share/grav; \
|
||||||
\
|
|
||||||
git clone --branch $GRAV_VERSION https://github.com/getgrav/grav.git /usr/share/grav; \
|
|
||||||
cd /usr/share/grav; \
|
cd /usr/share/grav; \
|
||||||
rm -rf \
|
rm -rf \
|
||||||
.editorconfig \
|
.editorconfig \
|
||||||
|
|
|
@ -3,8 +3,8 @@ set -eu
|
||||||
|
|
||||||
GRAV_FOLDER=${GRAV_FOLDER:-html}
|
GRAV_FOLDER=${GRAV_FOLDER:-html}
|
||||||
|
|
||||||
mkdir -p /var/www/$GRAV_FOLDER
|
mkdir -p /var/www/"$GRAV_FOLDER"
|
||||||
cd /var/www/$GRAV_FOLDER
|
cd /var/www/"$GRAV_FOLDER"
|
||||||
|
|
||||||
rsync -rlD --delete \
|
rsync -rlD --delete \
|
||||||
--exclude /backup/ \
|
--exclude /backup/ \
|
||||||
|
@ -12,7 +12,7 @@ rsync -rlD --delete \
|
||||||
--exclude /tmp/ \
|
--exclude /tmp/ \
|
||||||
--exclude /vendor/ \
|
--exclude /vendor/ \
|
||||||
--exclude /user/ \
|
--exclude /user/ \
|
||||||
/usr/share/grav/ /var/www/$GRAV_FOLDER
|
/usr/share/grav/ /var/www/"$GRAV_FOLDER"
|
||||||
|
|
||||||
mkdir -p assets backup cache images logs tmp
|
mkdir -p assets backup cache images logs tmp
|
||||||
|
|
||||||
|
@ -20,6 +20,6 @@ bin/grav install
|
||||||
bin/grav clearcache
|
bin/grav clearcache
|
||||||
|
|
||||||
chown www-data /proc/self/fd/1 /proc/self/fd/2
|
chown www-data /proc/self/fd/1 /proc/self/fd/2
|
||||||
chown -R --from=root:root www-data:www-data /var/www/$GRAV_FOLDER
|
chown -R --from=root:root www-data:www-data /var/www/"$GRAV_FOLDER"
|
||||||
|
|
||||||
exec gosu www-data "$@"
|
exec gosu www-data "$@"
|
||||||
|
|
|
@ -8,8 +8,8 @@ GRAV_FOLDER=${GRAV_FOLDER:-html}
|
||||||
usermod -o -u "$UID" foo
|
usermod -o -u "$UID" foo
|
||||||
groupmod -o -g "$GID" foo
|
groupmod -o -g "$GID" foo
|
||||||
|
|
||||||
mkdir -p /var/www/$GRAV_FOLDER
|
mkdir -p /var/www/"$GRAV_FOLDER"
|
||||||
cd /var/www/$GRAV_FOLDER
|
cd /var/www/"$GRAV_FOLDER"
|
||||||
|
|
||||||
rsync -rlD --delete \
|
rsync -rlD --delete \
|
||||||
--exclude /backup/ \
|
--exclude /backup/ \
|
||||||
|
@ -17,7 +17,7 @@ rsync -rlD --delete \
|
||||||
--exclude /tmp/ \
|
--exclude /tmp/ \
|
||||||
--exclude /vendor/ \
|
--exclude /vendor/ \
|
||||||
--exclude /user/ \
|
--exclude /user/ \
|
||||||
/usr/share/grav/ /var/www/$GRAV_FOLDER
|
/usr/share/grav/ /var/www/"$GRAV_FOLDER"
|
||||||
|
|
||||||
mkdir -p assets backup cache images logs tmp
|
mkdir -p assets backup cache images logs tmp
|
||||||
|
|
||||||
|
@ -25,6 +25,6 @@ bin/grav install
|
||||||
bin/grav clearcache
|
bin/grav clearcache
|
||||||
|
|
||||||
chown foo /proc/self/fd/1 /proc/self/fd/2
|
chown foo /proc/self/fd/1 /proc/self/fd/2
|
||||||
chown -R --from=root:root foo:foo /var/www/$GRAV_FOLDER
|
chown -R --from=root:root foo:foo /var/www/"$GRAV_FOLDER"
|
||||||
|
|
||||||
exec gosu foo "$@"
|
exec gosu foo "$@"
|
||||||
|
|
Loading…
Reference in a new issue