-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (112 loc) · 4.61 KB
/
docker-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Docker
on:
push:
branches-ignore: [ "*" ]
# Publish semver tags as releases.
tags: [ '*' ]
env:
# Web server application name
APP_NAME: apache
jobs:
build:
services:
registry:
image: registry:2
ports:
- 5000:5000
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Nextcloud version check
id: vercheck-nextcloud
run: |
sed -e "s/\(\([0-9]*\)\..*\)/version=\1\nmversion=\2/p" \
-e d \
nextcloud/latest.txt >> $GITHUB_OUTPUT
shell: bash
- name: PHP version check
id: vercheck-php
run: |
sed -e "s/^FROM php:\(.*\)-\(.*\)-\(.*\)/version=\1\napp=\2\ndebian=\3/p" \
-e d \
nextcloud/${{ steps.vercheck-nextcloud.outputs.mversion }}/$APP_NAME/Dockerfile >> $GITHUB_OUTPUT
shell: bash
- name: PHP Dockerfile modify
id: modify-php
run: |
sed -i \
-e "s/\(--with-apxs2\)/\1 --enable-zts --disable-zend-signals --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data /g" \
-e "s/\(gnupg\)/\1 aria2/g" \
-e "s/curl -fsSL/aria2c -x8/g" \
php/${{ steps.vercheck-php.outputs.version }}/${{ steps.vercheck-php.outputs.debian }}/${{ steps.vercheck-php.outputs.app }}/Dockerfile
shell: bash
- name: Build PHP Docker local image
id: build-php
uses: docker/build-push-action@v5
with:
context: ./php/${{ steps.vercheck-php.outputs.version }}/${{ steps.vercheck-php.outputs.debian }}/${{ steps.vercheck-php.outputs.app }}
push: true
tags: localhost:5000/${{ github.repository_owner }}/local-php:${{ steps.vercheck-php.outputs.version }}-${{ steps.vercheck-php.outputs.app }}-zts-${{ steps.vercheck-php.outputs.debian }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Nextcloud Dockerfile modify
id: modify-nextcloud
run: |
sed -i -e "s!FROM .*!FROM localhost:5000/whitehara/local-php:${{ steps.vercheck-php.outputs.version }}-${{ steps.vercheck-php.outputs.app }}-zts-${{ steps.vercheck-php.outputs.debian }}!g" \
-e "s/\(gnupg\)/\1 aria2/g" \
-e "s/curl -fsSL/aria2c -x8/g" \
nextcloud/${{ steps.vercheck-nextcloud.outputs.mversion }}/${{ steps.vercheck-php.outputs.app }}/Dockerfile
shell: bash
- name: Build Nextcloud Docker image
id: build-nextcloud
uses: docker/build-push-action@v5
with:
context: ./nextcloud/${{ steps.vercheck-nextcloud.outputs.mversion }}/${{ steps.vercheck-php.outputs.app }}
push: true
tags: localhost:5000/${{ github.repository_owner }}/local-nextcloud:${{ steps.vercheck-nextcloud.outputs.mversion }}-${{ steps.vercheck-php.outputs.app }}-zts
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Nextcloud-custom Dockerfile modify
id: modify-nextcloud-custom
run: |
sed -i -e "s!FROM .*!FROM localhost:5000/${{ github.repository_owner }}/local-nextcloud:${{ steps.vercheck-nextcloud.outputs.mversion }}-${{ steps.vercheck-php.outputs.app }}-zts!g" \
./Dockerfile
shell: bash
- name: Docker Nextcloud-custom meta
id: meta-nextcloud-custom
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository }}
tags: |
type=semver,pattern={{version}},value=${{ steps.vercheck-nextcloud.outputs.version }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-nextcloud-custom.outputs.tags }}
labels: ${{ steps.meta-nextcloud-custom.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max