Skip to content

Commit

Permalink
feat: new alpine 3.19 base image for all php images
Browse files Browse the repository at this point in the history
  • Loading branch information
williarin committed Mar 2, 2024
1 parent 3e87d4d commit 08132fe
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 11 deletions.
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ all: alpine test-alpine php test-php
.PHONY: deploy
deploy: alpine php

.PHONY: alpine alpine313 alpine314 alpine315 alpine316 alpine318 alpineedge
alpine: alpine318 alpineedge
.PHONY: alpine alpine313 alpine314 alpine315 alpine316 alpine318 alpine319 alpineedge
alpine: alpine318 alpine319 alpineedge

alpine313:
docker $(BUILDX) build $(PUSH) --no-cache $(PLATFORM) -t $(REGISTRY)williarin/alpine:3.13 alpine/3.13
Expand All @@ -41,7 +41,10 @@ alpine316:
docker $(BUILDX) build $(PUSH) --no-cache $(PLATFORM) -t $(REGISTRY)williarin/alpine:3.16 alpine/3.16

alpine318:
docker $(BUILDX) build $(PUSH) --no-cache $(PLATFORM) -t $(REGISTRY)williarin/alpine:3.18 -t $(REGISTRY)williarin/alpine:latest alpine/3.18
docker $(BUILDX) build $(PUSH) --no-cache $(PLATFORM) -t $(REGISTRY)williarin/alpine:3.18 alpine/3.18

alpine319:
docker $(BUILDX) build $(PUSH) --no-cache $(PLATFORM) -t $(REGISTRY)williarin/alpine:3.19 -t $(REGISTRY)williarin/alpine:latest alpine/3.19

alpineedge:
docker $(BUILDX) build $(PUSH) --no-cache $(PLATFORM) -t $(REGISTRY)williarin/alpine:edge alpine/edge
Expand Down Expand Up @@ -69,6 +72,10 @@ test-alpine318:
docker run --rm $(REGISTRY)williarin/alpine:3.18 /bin/sh -c "zsh --version | grep -e '^zsh [0-9]\.[0-9]'"
docker run --rm $(REGISTRY)williarin/alpine:3.18 /bin/sh -c "cat /etc/os-release | grep -e 'Alpine Linux v3.18'"

test-alpine319:
docker run --rm $(REGISTRY)williarin/alpine:3.19 /bin/sh -c "zsh --version | grep -e '^zsh [0-9]\.[0-9]'"
docker run --rm $(REGISTRY)williarin/alpine:3.19 /bin/sh -c "cat /etc/os-release | grep -e 'Alpine Linux v3.19'"

test-alpineedge:
docker run --rm $(REGISTRY)williarin/alpine:edge /bin/sh -c "zsh --version | grep -e '^zsh [0-9]\.[0-9]'"
docker run --rm $(REGISTRY)williarin/alpine:edge /bin/sh -c "cat /etc/os-release | grep -e 'Alpine Linux edge'"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,22 @@ docker run --rm -it -u '1000:1000' williarin/alpine
| ------ | ---- |
| williarin/alpine:edge | [![](https://img.shields.io/docker/image-size/williarin/alpine/edge)](https://hub.docker.com/r/williarin/alpine) |
| williarin/alpine:latest | [![](https://img.shields.io/docker/image-size/williarin/alpine/latest)](https://hub.docker.com/r/williarin/alpine) |
| williarin/alpine:3.19 | [![](https://img.shields.io/docker/image-size/williarin/alpine/3.19)](https://hub.docker.com/r/williarin/alpine) |
| williarin/alpine:3.18 | [![](https://img.shields.io/docker/image-size/williarin/alpine/3.18)](https://hub.docker.com/r/williarin/alpine) |
| williarin/alpine:3.16 [deprecated] | [![](https://img.shields.io/docker/image-size/williarin/alpine/3.16)](https://hub.docker.com/r/williarin/alpine) |
| williarin/alpine:3.15 [deprecated] | [![](https://img.shields.io/docker/image-size/williarin/alpine/3.15)](https://hub.docker.com/r/williarin/alpine) |
| williarin/alpine:3.14 [deprecated] | [![](https://img.shields.io/docker/image-size/williarin/alpine/3.14)](https://hub.docker.com/r/williarin/alpine) |
| williarin/alpine:3.13 [deprecated] | [![](https://img.shields.io/docker/image-size/williarin/alpine/3.13)](https://hub.docker.com/r/williarin/alpine) |

_**Note:** `latest` is equivalent to `3.18`_
_**Note:** `latest` is equivalent to `3.19`_

## PHP 7.4, 8.0, 8.1, 8.2, 8.3 images

Images are built once a week at 00:00 on Monday.

### Details

All PHP images are based on Alpine Linux 3.18 ([williarin/alpine](#alpine-linux-with-zsh)). They come with `bash`, `zsh`, `zip`, `unzip` and widely used PHP extensions.
All PHP images are based on Alpine Linux 3.19 ([williarin/alpine](#alpine-linux-with-zsh)). They come with `bash`, `zsh`, `zip`, `unzip` and widely used PHP extensions.

Installed PHP extensions:

Expand Down
27 changes: 27 additions & 0 deletions alpine/3.19/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM alpine:3.19

RUN set -eux; \
apk update; \
apk add icu-data-full exa tzdata git zsh-vcs zsh zsh-autosuggestions zsh-syntax-highlighting; \
cat "/usr/share/zoneinfo/UTC" > /etc/localtime

COPY docker/ /ohmyzsh/

RUN set -eux; \
wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh; \
ZSH=/ohmyzsh/.oh-my-zsh sh install.sh --unattended --keep-zshrc; \
rm ./install.sh; \
git clone https://github.com/spaceship-prompt/spaceship-prompt.git "/ohmyzsh/.oh-my-zsh/themes/spaceship-prompt" --depth=1; \
ln -s "/ohmyzsh/.oh-my-zsh/themes/spaceship-prompt/spaceship.zsh-theme" "/ohmyzsh/.oh-my-zsh/themes/spaceship.zsh-theme"

RUN addgroup -S 1000; \
adduser -D -S -u 1000 -G 1000 -h /home/dockeruser -s /bin/sh dockeruser;

RUN apk del git tzdata \
&& chmod +x /ohmyzsh/docker-entrypoint \
&& cp /ohmyzsh/zsh/.[^.]* /root/ \
&& mv /ohmyzsh/zsh/.[^.]* /home/dockeruser/ \
&& chown -R 1000:1000 /home/dockeruser/ \
&& rm -rf /var/cache/apk/*

CMD [ "/ohmyzsh/docker-entrypoint" ]
6 changes: 6 additions & 0 deletions alpine/3.19/docker/docker-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e

if [ -t 1 ]; then
exec zsh
fi
4 changes: 4 additions & 0 deletions alpine/3.19/docker/zsh/.aliases.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alias ls="exa --icons --group-directories-first"
alias l="exa -aaghl --git --icons --group-directories-first"
alias ll="exa -ghl --git --icons --group-directories-first"
alias lt="exa --tree --level=2 --icons --group-directories-first"
10 changes: 10 additions & 0 deletions alpine/3.19/docker/zsh/.zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export ZSH="/ohmyzsh/.oh-my-zsh"

ZSH_THEME="spaceship"
ZSH_DISABLE_COMPFIX=true

source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source $ZSH/oh-my-zsh.sh

[ -f ~/.aliases.zsh ] && source ~/.aliases.zsh
5 changes: 4 additions & 1 deletion php/8.0/docker/scripts/install-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ apk --no-cache add \

apk --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/v3.16/main add 'icu-libs==71.1-r2';

apk --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/v3.16/community add \
apk --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/v3.16/community \
--repository=https://dl-cdn.alpinelinux.org/alpine/v3.16/main \
add \
php8 \
php8-ctype \
php8-curl \
Expand Down
5 changes: 4 additions & 1 deletion php/8.1/docker/scripts/install-packages.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/sh
set -ex

apk --no-cache add \
apk --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/v3.18/community \
--repository=https://dl-cdn.alpinelinux.org/alpine/v3.18/main \
add \
bash \
zip unzip \
icu-libs \
Expand Down
7 changes: 4 additions & 3 deletions php/8.2/docker/scripts/install-packages.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/sh
set -ex

apk --no-cache add \
apk --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/v3.19/community \
--repository=https://dl-cdn.alpinelinux.org/alpine/v3.19/main \
add \
bash \
zip unzip \
icu-libs \
Expand Down Expand Up @@ -36,5 +39,3 @@ apk --no-cache add \
php82-fileinfo \
php82-sodium \
php82-opcache

ln -s /usr/bin/php82 /usr/bin/php
6 changes: 5 additions & 1 deletion php/8.3/docker/scripts/install-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ apk --no-cache add \

apk --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main add libavif icu-libs libsodium

apk --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community add \
apk --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/main \
add \
php83 \
php83-ctype \
php83-curl \
Expand Down Expand Up @@ -39,4 +42,5 @@ apk --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
php83-sodium \
php83-opcache

rm -f /usr/bin/php
ln -s /usr/bin/php83 /usr/bin/php

0 comments on commit 08132fe

Please sign in to comment.