Skip to content

Commit

Permalink
switch to Debian vs Fedora
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmccallister committed Nov 10, 2023
1 parent 7f78680 commit fdc5fe8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG fedora_version
FROM fedora:${fedora_version}
ARG debian_version
FROM debian:${debian_version}

ARG userid=3000
ARG groupid=3000
Expand Down Expand Up @@ -34,16 +34,15 @@ ENV PHP_OPCACHE_MAX_WASTED_PERCENTAGE=$PHP_OPCACHE_MAX_WASTED_PERCENTAGE_ARG
ENV PHP_OPCACHE_INTERNED_STRINGS_BUFFER=$PHP_OPCACHE_INTERNED_STRINGS_BUFFER_ARG
ENV PHP_OPCACHE_FAST_SHUTDOWN=$PHP_OPCACHE_FAST_SHUTDOWN_ARG

# speed up dnf (https://ostechnix.com/how-to-speed-up-dnf-package-manager-in-fedora/)
RUN echo 'max_parallel_downloads=10' >> /etc/dnf/dnf.conf

# add the application user
RUN groupadd -r -g ${groupid} appgroup \
&& useradd --no-create-home --no-log-init --system --home-dir=/app --uid ${userid} --gid ${groupid} appuser

RUN mkdir -p /app && chown -R appuser:appgroup /app

RUN dnf --disablerepo=fedora-cisco-openh264 install -y \
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt update -y \
&& apt install -y \
curl \
unzip \
nginx \
Expand All @@ -64,8 +63,9 @@ RUN dnf --disablerepo=fedora-cisco-openh264 install -y \
php-soap \
php-xml \
php-zip \
&& dnf --disablerepo=fedora-cisco-openh264 update -y \
&& dnf --disablerepo=fedora-cisco-openh264 clean all -y
&& apt upgrade -y \
&& apt autoremove -y \
&& apt clean -y

# copy the files from the host to the container that we need
COPY etc/supervisord.conf /etc/supervisord.conf
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
IMAGE ?= craftcms/image
PHP_VERSION ?= 8.2
FEDORA_VERSION ?= 39
DEBIAN_VERSION ?= 12

build:
docker build \
--build-arg php_version=${PHP_VERSION} \
--build-arg fedora_version=${FEDORA_VERSION} \
--build-arg debian_version=${DEBIAN_VERSION} \
--no-cache \
--progress plain \
--tag ${IMAGE}:${PHP_VERSION} .
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ In this example, we’re setting the PHP memory limit to `512M` rather than the
version: "3.6"
services:
php-fpm:
image: ghcr.io/craftcms/image:8.1
image: ghcr.io/craftcms/image:8.2
volumes:
- .:/app
env_file: .env
Expand All @@ -70,16 +70,14 @@ services:
| `opcache.interned_strings_buffer` | `PHP_OPCACHE_INTERNED_STRINGS_BUFFER` | `16` |
| `opcache.fast_shutdown` | `PHP_OPCACHE_FAST_SHUTDOWN` | `1` |

## Upgrading Fedora
## Upgrading Debian

In order to update Fedora (e.g. Fedora 38 was released), follow these steps:
In order to update Debian (e.g.Debian 13 was released), follow these steps:

1. Update the `FEDORA_VERSION` in the `Makefile` to the new version (e.g. `FEDORA_VERSION=38`). This will update the
1. Update the `DEBIAN_VERSION` in the `Makefile` to the new version (e.g. `DEBIAN_VERSION=13`). This will update the
base image used for the build.
2. Update the `PHP_VERSION` in the `Makefile` to the new version (e.g. `PHP_VERSION=8.2`). This will update the
PHP version installed in the image.
3. Then, run `make build` to rebuild the image to test locally.

> Note: The version of Fedora determines the version of PHP that is installed. For example, Fedora 38 uses PHP 8.2 and Fedora 37 uses 8.1.

> Note: The version of Debian determines the version of PHP that is installed. For example, Debian 12 uses PHP 8.2.
2 changes: 1 addition & 1 deletion examples/craftcms/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ USER root

# copy the files from the host to the container that we need
COPY etc/nginx/nginx.conf /etc/nginx/nginx.conf
COPY etc/supervisord.d/nginx.ini /etc/supervisord.d/nginx.ini
#COPY etc/supervisord.d/nginx.ini /etc/supervisord.d/nginx.ini

# set the sockets and pid files to be writable by the appuser
RUN mkdir -p /var/log/nginx && chown -R appuser:appgroup /var/log/nginx
Expand Down

0 comments on commit fdc5fe8

Please sign in to comment.