Skip to content

Commit

Permalink
use more modern syntax, upgrade to php 8.3, setup dependabot
Browse files Browse the repository at this point in the history
  • Loading branch information
desaintmartin committed Jul 21, 2024
1 parent 3268bac commit a427daf
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 25 deletions.
54 changes: 29 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,51 @@
# syntax=docker/dockerfile:1
# syntax=docker/dockerfile:1.9@sha256:5510f694edfe648d961b59dcf217026485e560d2663c73e45067b8c8d7a6d247

### Stage 1: build client
FROM node:20 as client-builder
FROM node:20 AS client-builder
WORKDIR /client-builder

# Install node packages
COPY package.json .
COPY client/package.json client/
COPY client/package-lock.json client/
RUN npm run install-dependencies:client
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=client/package.json,target=client/package.json \
--mount=type=bind,source=client/package-lock.json,target=client/package-lock.json \
--mount=type=cache,sharing=locked,id=npmcache,mode=0777,target=/root/.npm \
npm run install-dependencies-ci:client

# Build client
COPY client/ client/
RUN npm run build
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=client/package.json,target=client/package.json \
--mount=type=bind,source=client/package-lock.json,target=client/package-lock.json \
--mount=type=cache,sharing=locked,id=npmcache,mode=0777,target=/root/.npm \
npm run build


### Stage 2: final container
FROM php:8.2-apache
FROM php:8.3-apache
# Install runtime & development package dependencies & php extensions
# then clean-up dev package dependencies
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt update \
&& apt install -y --no-install-recommends \
unzip \
libjpeg62-turbo libpng16-16 libpq5 libonig5 libtidy5deb1 \
libjpeg62-turbo-dev libpng-dev libpq-dev libonig-dev libtidy-dev \
&& update-ca-certificates --fresh \
&& docker-php-ext-configure gd --with-jpeg \
&& docker-php-ext-install gd mbstring pdo_pgsql pdo_mysql tidy \
&& apt remove -y libjpeg62-turbo-dev libpng-dev libpq-dev libonig-dev libtidy-dev \
&& apt autoremove -y \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*
&& apt update \
&& apt install -y --no-install-recommends \
unzip \
libjpeg62-turbo libpng16-16 libpq5 libonig5 libtidy5deb1 \
libjpeg62-turbo-dev libpng-dev libpq-dev libonig-dev libtidy-dev \
&& update-ca-certificates --fresh \
&& docker-php-ext-configure gd --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd mbstring pdo_pgsql pdo_mysql tidy \
&& apt remove -y libjpeg62-turbo-dev libpng-dev libpq-dev libonig-dev libtidy-dev \
&& apt autoremove -y \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*

# Install Apache modules
RUN a2enmod headers rewrite

# Install Selfoss PHP dependencies
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
COPY composer.json .
COPY composer.lock .
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --optimize-autoloader --no-dev
RUN rm /usr/bin/composer
RUN --mount=type=bind,source=composer.json,target=composer.json \
--mount=type=bind,source=composer.lock,target=composer.lock \
--mount=type=bind,from=composer:2,source=/usr/bin/composer,target=/usr/bin/composer \
COMPOSER_ALLOW_SUPERUSER=1 composer install --optimize-autoloader --no-dev

# Install Selfoss and copy frontend from the first stage
WORKDIR /var/www/html
Expand Down
34 changes: 34 additions & 0 deletions dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
versioning-strategy: increase-if-necessary
commit-message:
prefix: "Composer"
include: "scope"
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/"
versioning-strategy: increase-if-necessary
commit-message:
prefix: "NPM"
include: "scope"
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/client"
versioning-strategy: increase-if-necessary
commit-message:
prefix: "NPM"
include: "scope"
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "/"
versioning-strategy: increase-if-necessary
commit-message:
prefix: "Docker"
include: "scope"
schedule:
interval: "daily"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"fix:helpers:cs": "black utils/ tests/",
"install-dependencies": "npm run install-dependencies:client && npm run install-dependencies:server",
"install-dependencies:client": "npm install --production=false --prefix client/",
"install-dependencies-ci:client": "npm ci --production=false --prefix client/",
"install-dependencies:server": "composer install --dev",
"test:server": "composer run-script test",
"test:integration": "python3 tests/integration/run.py",
Expand Down

0 comments on commit a427daf

Please sign in to comment.