Skip to content

Commit

Permalink
Merge pull request #157 from crazy-max/update-5
Browse files Browse the repository at this point in the history
Matomo 5.0.3
  • Loading branch information
crazy-max authored May 26, 2024
2 parents 80e625b + a22ed11 commit 4c57646
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- '**.md'

env:
LATEST_DOCKERFILE: 5.Dockerfile
DOCKERHUB_SLUG: crazymax/matomo
GHCR_SLUG: ghcr.io/crazy-max/matomo

Expand All @@ -27,6 +28,16 @@ jobs:
-
name: Checkout
uses: actions/checkout@v4
-
name: Prepare
run: |
DOCKERFILE=${{ env.LATEST_DOCKERFILE }}
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
VERSION=${TAG%-*}
DOCKERFILE=${TAG%%.*}.Dockerfile
fi
echo "DOCKERFILE=${DOCKERFILE}" >> $GITHUB_ENV
-
name: Docker meta
id: meta
Expand All @@ -39,6 +50,8 @@ jobs:
type=match,pattern=(.*)-r,group=1
type=ref,event=pr
type=edge
flavor: |
latest=${{ env.DOCKERFILE == env.LATEST_DOCKERFILE && startsWith(github.ref, 'refs/tags/') }}
labels: |
org.opencontainers.image.title=Matomo
org.opencontainers.image.description=Matomo (formerly Piwik)
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ env:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dockerfile:
- 4.Dockerfile
- 5.Dockerfile
steps:
-
name: Checkout
Expand All @@ -38,6 +44,7 @@ jobs:
targets: image-local
env:
DEFAULT_TAG: ${{ env.BUILD_TAG }}
DOCKERFILE: ${{ matrix.dockerfile }}
-
name: Start
run: |
Expand Down
File renamed without changes.
80 changes: 80 additions & 0 deletions 5.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# syntax=docker/dockerfile:1

ARG MATOMO_VERSION=5.0.3
ARG ALPINE_VERSION=3.19

FROM crazymax/yasu:latest AS yasu
FROM --platform=${BUILDPLATFORM:-linux/amd64} crazymax/alpine-s6:${ALPINE_VERSION}-2.2.0.3 AS download
RUN apk --update --no-cache add curl tar unzip xz

ARG MATOMO_VERSION
WORKDIR /dist/matomo
RUN curl -sSL "https://builds.matomo.org/matomo-${MATOMO_VERSION}.tar.gz" | tar xz matomo --strip 1
RUN curl -sSL "https://matomo.org/wp-content/uploads/unifont.ttf.zip" -o "unifont.ttf.zip"
RUN unzip "unifont.ttf.zip" -d "./plugins/ImageGraph/fonts/"
RUN rm -f "unifont.ttf.zip"

WORKDIR /dist/mmdb
RUN curl -SsOL "https://github.com/crazy-max/geoip-updater/raw/mmdb/GeoLite2-ASN.mmdb" \
&& curl -SsOL "https://github.com/crazy-max/geoip-updater/raw/mmdb/GeoLite2-City.mmdb" \
&& curl -SsOL "https://github.com/crazy-max/geoip-updater/raw/mmdb/GeoLite2-Country.mmdb"

FROM crazymax/alpine-s6:${ALPINE_VERSION}-2.2.0.3

COPY --from=yasu / /
COPY --from=download --chown=nobody:nogroup /dist/matomo /var/www/matomo
COPY --from=download --chown=nobody:nogroup /dist/mmdb /var/mmdb

ENV S6_BEHAVIOUR_IF_STAGE2_FAILS="2" \
TZ="UTC" \
PUID="1000" \
PGID="1000" \
MATOMO_PLUGIN_DIRS="/var/www/matomo/data-plugins/;data-plugins" \
MATOMO_PLUGIN_COPY_DIR="/var/www/matomo/data-plugins/"

RUN apk --update --no-cache add \
bash \
ca-certificates \
curl \
libmaxminddb \
nginx \
openssl \
php82 \
php82-bcmath \
php82-cli \
php82-ctype \
php82-curl \
php82-dom \
php82-iconv \
php82-fpm \
php82-gd \
php82-gmp \
php82-json \
php82-ldap \
php82-mbstring \
php82-opcache \
php82-openssl \
php82-pdo \
php82-pdo_mysql \
php82-pecl-maxminddb \
php82-redis \
php82-session \
php82-simplexml \
php82-xml \
php82-zlib \
rsync \
shadow \
tzdata \
&& addgroup -g ${PGID} matomo \
&& adduser -D -H -u ${PUID} -G matomo -h /var/www/matomo -s /bin/sh matomo \
&& rm -rf /tmp/*

COPY rootfs /

EXPOSE 8000
VOLUME [ "/data" ]

ENTRYPOINT [ "/init" ]

HEALTHCHECK --interval=30s --timeout=20s --start-period=10s \
CMD /usr/local/bin/healthcheck
11 changes: 10 additions & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,27 @@ variable "DEFAULT_TAG" {
default = "matomo:local"
}

variable "DOCKERFILE" {
default = "5.Dockerfile"
}

// Special target: https://github.com/docker/metadata-action#bake-definition
target "docker-metadata-action" {
tags = ["${DEFAULT_TAG}"]
}

target "_common" {
inherits = ["docker-metadata-action"]
dockerfile = DOCKERFILE
}

// Default target if none specified
group "default" {
targets = ["image-local"]
}

target "image" {
inherits = ["docker-metadata-action"]
inherits = ["_common"]
}

target "image-local" {
Expand Down

0 comments on commit 4c57646

Please sign in to comment.