Skip to content
This repository was archived by the owner on Jan 24, 2023. It is now read-only.

Commit 8de402c

Browse files
authored
Initial contribution of the base PHP Dockerfile (#1)
This Dockerfile is responsible for the base PHP image which will be used in the che-devfile-registry. It is not sufficient to use the plain upstream PHP image, so we add some customizations necessary for all the PHP workflows we support. See eclipse-che/che#15854 Signed-off-by: Eric Williams <[email protected]>
1 parent 74fc4dc commit 8de402c

File tree

5 files changed

+126
-286
lines changed

5 files changed

+126
-286
lines changed

.github/workflows/build-publish.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#
2+
# Copyright (c) 2020 Red Hat, Inc.
3+
# This program and the accompanying materials are made
4+
# available under the terms of the Eclipse Public License 2.0
5+
# which is available at https://www.eclipse.org/legal/epl-2.0/
6+
#
7+
# SPDX-License-Identifier: EPL-2.0
8+
#
9+
10+
name: Build and push container
11+
12+
on:
13+
push:
14+
branches:
15+
- '7.4'
16+
17+
jobs:
18+
build:
19+
env:
20+
IMAGE_NAME: quay.io/eclipse/che-php-base
21+
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
26+
- name: Clone source code
27+
uses: actions/checkout@v1
28+
with:
29+
fetch-depth: 1
30+
31+
- name: Docker build
32+
run: |
33+
echo "Building image ${IMAGE_NAME}"
34+
docker build -t ${IMAGE_NAME} .
35+
- name: Docker publish
36+
run: |
37+
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" quay.io
38+
GIT_BRANCH=$(echo "${GITHUB_REF}" | cut -d / -f 3)
39+
echo "GIT_BRANCH is ${GIT_BRANCH} and GITHUB_REF is ${GITHUB_REF}"
40+
GIT_TAG="latest"
41+
if [[ "$GIT_BRANCH" != "master" ]]; then
42+
GIT_TAG=${GIT_BRANCH}
43+
fi
44+
# Publish with tag name
45+
echo "Publishing image ${IMAGE_NAME}:${GIT_TAG}"
46+
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${GIT_TAG}"
47+
docker push "${IMAGE_NAME}:${GIT_TAG}"
48+
# and with specific sha-1
49+
echo "Publishing image ${IMAGE_NAME}:${GIT_TAG}-${SHORT_SHA1}"
50+
SHORT_SHA1=$(git rev-parse --short HEAD)
51+
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${GIT_TAG}-${SHORT_SHA1}"
52+
docker push "${IMAGE_NAME}:${GIT_TAG}-${SHORT_SHA1}"
53+
env:
54+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
55+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

.github/workflows/pr-check.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# Copyright (c) 2020 Red Hat, Inc.
3+
# This program and the accompanying materials are made
4+
# available under the terms of the Eclipse Public License 2.0
5+
# which is available at https://www.eclipse.org/legal/epl-2.0/
6+
#
7+
# SPDX-License-Identifier: EPL-2.0
8+
#
9+
10+
name: PR check
11+
12+
on:
13+
pull_request:
14+
15+
jobs:
16+
build:
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
22+
- name: Clone source code
23+
uses: actions/checkout@v1
24+
with:
25+
fetch-depth: 1
26+
27+
- name: Docker build
28+
run: |
29+
echo "Building image..."
30+
docker build .

Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright (c) 2020 Red Hat, Inc.
2+
# This program and the accompanying materials are made
3+
# available under the terms of the Eclipse Public License 2.0
4+
# which is available at https://www.eclipse.org/legal/epl-2.0/
5+
#
6+
# SPDX-License-Identifier: EPL-2.0
7+
#
8+
# Contributors:
9+
# Red Hat, Inc. - initial API and implementation
10+
11+
FROM php:7.4-apache
12+
13+
RUN apt-get -y update \
14+
&& apt-get install -y libicu-dev\
15+
tree \
16+
vim \
17+
wget \
18+
git \
19+
libzip-dev \
20+
zlib1g-dev \
21+
zip \
22+
&& docker-php-ext-configure intl \
23+
&& docker-php-ext-install intl \
24+
&& docker-php-ext-install zip mysqli pdo pdo_mysql \
25+
&& chmod -R 777 /etc/apache2 /var/www /var/lib/apache2 /var/log \
26+
&& chown -R www-data:www-data /var/www \
27+
\
28+
#change Apache configuration
29+
\
30+
&& sed -i "s/80/8080/g" /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf \
31+
&& sed -i 's/\/var\/www\/html/\/projects/g' /etc/apache2/sites-available/000-default.conf \
32+
&& sed -i 's/\/var\/www/\/projects/g' /etc/apache2/apache2.conf \
33+
&& sed -i 's/None/All/g' /etc/apache2/sites-available/000-default.conf \
34+
&& echo "ServerName localhost" | tee -a /etc/apache2/apache2.conf
35+
36+
#add composer
37+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
38+
39+
WORKDIR /projects
40+
41+
CMD sleep infinity

0 commit comments

Comments
 (0)