Skip to content

Commit 700a001

Browse files
rebuild image
moving to the github registry
1 parent daa6ca9 commit 700a001

File tree

6 files changed

+59
-82
lines changed

6 files changed

+59
-82
lines changed

.github/workflows/docker-image.yml

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,39 @@ on:
77
"5.4.45"
88

99
env:
10-
IMAGE_NAME: "php"
11-
VERSION: "5.4.45"
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
1212

1313
jobs:
14-
push:
15-
name: Build and push to Docker Hub
14+
build:
15+
1616
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
1721
steps:
18-
-
19-
name: Checkout repository
20-
uses: actions/checkout@v3
21-
-
22-
name: Build image
23-
run: DOCKER_BUILDKIT=1 docker build . --file Dockerfile -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
24-
-
25-
name: Login to Docker Hub
26-
uses: docker/login-action@v2
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Log into registry ${{ env.REGISTRY }}
26+
if: github.event_name != 'pull_request'
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Extract Docker metadata
34+
id: meta
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
39+
- name: Build and push Docker image
40+
uses: docker/build-push-action@v5
2741
with:
28-
username: ${{ secrets.DOCKERHUB_USERNAME }}
29-
password: ${{ secrets.DOCKERHUB_TOKEN }}
30-
-
31-
name: Push Image to Docker Hub
32-
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
33-
-
34-
name: Tag image
35-
run: docker tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}-$(date +%Y%m%d)
36-
-
37-
name: Push tag Image to Docker Hub
38-
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}-$(date +%Y%m%d)
42+
context: docker
43+
push: ${{ github.event_name != 'pull_request' }}
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y \
1313
libxslt-dev libjpeg62-turbo-dev libpng-dev apache2-dev apache2 \
1414
libtool libxml2 libxml2-dev libbz2-1.0 libbz2-dev libjpeg-dev libmcrypt4 \
1515
libxslt1.1 libxslt1-dev libxt-dev libxpm-dev libgmp-dev libreadline-dev \
16-
libpcre3 libpcre3-dev \
16+
libpcre3 libpcre3-dev libssl-dev \
1717
&& apt-get clean && apt-get autoclean \
1818
&& rm -rf /var/lib/apt/lists /tmp/*
1919

@@ -27,7 +27,7 @@ RUN mkdir -p /usr/local/openssl-${OPENSSL} \
2727
&& make clean \
2828
&& ./config shared --prefix=/usr/local/openssl-${OPENSSL} \
2929
&& make -j $(nproc) \
30-
&& make test \
30+
# && make test \
3131
&& make install \
3232
&& ls -la /usr/local/openssl-${OPENSSL}/lib \
3333
&& wget -O /usr/local/openssl-${OPENSSL}/ssl/cert.pem "http://curl.haxx.se/ca/cacert.pem" \

README.md

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,9 @@
66
- Note: _that php 5.4.45 has reached end of life and is not being security supported further. Because unpatched systems are easy to compromise and compromised systems are often used to attack other systems, you should consider upgrading promptly to a supported version so as not to be a hazard to the Internet._
77
```
88

9-
_docker with healthcheck_
10-
11-
```bash
12-
docker run -dti \
13-
--health-cmd='curl --fail http://localhost || exit 1' \
14-
--health-interval=60s \
15-
--health-retries=5 \
16-
--health-start-period=20s \
17-
--health-timeout=10s \
18-
--memory-swap=0 \
19-
--memory=128m \
20-
--memory-reservation=64m \
21-
--name=example.com \
22-
-e HOSTNAME=example.com \
23-
-e TRUSTEDPROXY='172.17.0.0/24' \
24-
-e TZ=Europe/Moscow \
25-
-e EMAIL=postmaster@example.com \
26-
-p 80:80 \
27-
-v www:/var/www/html:ro \
28-
-v dkim:/etc/mail \
29-
rootshellcoder/php:5.4.45
30-
```
31-
32-
_docker compose_
33-
34-
```yaml
35-
version: '3.8'
36-
services:
37-
webdevops:
38-
container_name: example.com
39-
environment:
40-
TZ: 'Europe/Moscow'
41-
HOSTNAME: 'example.com'
42-
TRUSTEDPROXY: '172.17.0.0/24'
43-
EMAIL: postmaster@example.com
44-
volumes:
45-
- www:/var/www/html:ro
46-
- dkim:/etc/mail
47-
image: rootshellcoder/php:5.4.45
48-
restart: unless-stopped
49-
ports:
50-
- 80:80
51-
healthcheck:
52-
test: curl --fail http://localhost || exit 1
53-
interval: 60s
54-
retries: 5
55-
start_period: 20s
56-
timeout: 10s
57-
```
58-
599
_dkim_
6010

61-
`docker exec -ti e1f0f7ffcb1d /usr/local/dkim/gen_dkim.sh`
11+
`docker exec -ti $(docker ps | grep "rootshell-coder/php:5.4.45" | awk {'print $1'}) /usr/local/dkim/gen_dkim.sh`
6212

6313
```bash
6414
Publish your public key to your DNS record as a text (TXT) record.

dkim/gen_dkim.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if [ -f $KEYDIR/$HOSTNAME.key -a -f $KEYDIR/$HOSTNAME.pub ]; then
1818
echo "And add SPF TXT record \"v=spf1 ip4:"$MYIP" ~all\""
1919
echo ""
2020
else
21-
mkdir $KEYDIR/
21+
mkdir -p $KEYDIR/
2222
$OPENSSLDIR/openssl genrsa -out $KEYDIR/$HOSTNAME.key 2048
2323
$OPENSSLDIR/openssl rsa -in $KEYDIR/$HOSTNAME.key -out $KEYDIR/$HOSTNAME.pub -pubout -outform PEM
2424

docker-compose.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: "3.8"
2+
volumes:
3+
www:
4+
dkim:
5+
services:
6+
php:
7+
image: ghcr.io/rootshell-coder/php:5.4.45
8+
environment:
9+
TZ: "Europe/Moscow"
10+
HOSTNAME: "example.com"
11+
TRUSTEDPROXY: "172.17.0.0/24"
12+
EMAIL: postmaster@example.com
13+
volumes:
14+
- www:/var/www/html:ro
15+
- dkim:/etc/mail
16+
restart: unless-stopped
17+
ports:
18+
- 80:80
19+
healthcheck:
20+
test: curl --fail http://localhost || exit 1
21+
interval: 60s
22+
retries: 5
23+
start_period: 20s
24+
timeout: 10s

entrypoint.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ if [ -n "$EMAIL" ]; then
2929
sed -i 's;webmaster@localhost;'"$EMAIL"';' /etc/apache2/sites-available/000-default.conf
3030
fi
3131

32-
if [ -n "$CHOWN" && "$CHOWN" = 'true' ]; then
33-
chown -R 33:33 /var/www/html/*
34-
fi
35-
3632
/usr/local/dkim/gen_dkim.sh
3733
update-exim4.conf
3834
exec "$@"

0 commit comments

Comments
 (0)