Skip to content

Commit d804eb2

Browse files
authored
Merge pull request #1 from Coderockr/feat/build-with-github
feat: build with GitHub
2 parents 243c35a + bc014ae commit d804eb2

2 files changed

Lines changed: 99 additions & 0 deletions

File tree

.github/workflows/build.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Publish Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
- "v*.*"
8+
- "v*.*-*"
9+
tags:
10+
- "v*.*.*"
11+
- "v*.*.*-*"
12+
13+
pull_request:
14+
15+
jobs:
16+
push_to_registry:
17+
name: Push Docker image to Docker Hub
18+
runs-on: ubuntu-latest
19+
20+
permissions:
21+
packages: write
22+
contents: read
23+
24+
steps:
25+
- name: Check out the repo
26+
uses: actions/checkout@v2
27+
28+
- name: Log in to Docker Hub
29+
if: github.event_name != 'pull_request'
30+
uses: docker/login-action@v1.12.0
31+
with:
32+
username: ${{ secrets.DOCKER_USERNAME }}
33+
password: ${{ secrets.DOCKER_PASSWORD }}
34+
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v1
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v1
40+
41+
- name: Log in to the Container registry
42+
if: github.event_name != 'pull_request'
43+
uses: docker/login-action@v1.12.0
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Extract metadata (tags, labels) for Docker
50+
id: meta
51+
uses: docker/metadata-action@v3
52+
with:
53+
images: |
54+
coderockr/php-fpm
55+
ghcr.io/${{ github.repository }}
56+
tags: |
57+
type=schedule
58+
type=ref,event=branch
59+
type=ref,event=pr
60+
type=semver,pattern={{version}}
61+
type=semver,pattern={{major}}.{{minor}}
62+
type=semver,pattern={{major}}
63+
type=sha
64+
65+
- name: Build and push Docker image
66+
uses: docker/build-push-action@v2.7.0
67+
with:
68+
context: .
69+
push: ${{ github.event_name != 'pull_request' }}
70+
tags: ${{ steps.meta.outputs.tags }}
71+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM php:7.3.2
2+
3+
# RUN echo "Install libs & PHP extensions"
4+
RUN apt-get update && apt-get install -y \
5+
zip \
6+
libzip-dev \
7+
git \
8+
libfreetype6-dev \
9+
libicu-dev \
10+
libjpeg62-turbo-dev \
11+
gettext \
12+
locales
13+
14+
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && locale-gen
15+
16+
RUN docker-php-ext-configure gettext --with-gettext=/usr/include/ \
17+
&& docker-php-ext-install -j$(nproc) gettext \
18+
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
19+
&& docker-php-ext-install -j$(nproc) \
20+
zip \
21+
pdo_mysql \
22+
gd \
23+
intl \
24+
bcmath
25+
26+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer
27+
28+
USER www-data:www-data

0 commit comments

Comments
 (0)