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

Commit

Permalink
Initial contribution of the base PHP Dockerfile (#1)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ericwill authored Mar 26, 2020
1 parent 74fc4dc commit 8de402c
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 286 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#
# Copyright (c) 2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

name: Build and push container

on:
push:
branches:
- '7.4'

jobs:
build:
env:
IMAGE_NAME: quay.io/eclipse/che-php-base

runs-on: ubuntu-latest

steps:

- name: Clone source code
uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Docker build
run: |
echo "Building image ${IMAGE_NAME}"
docker build -t ${IMAGE_NAME} .
- name: Docker publish
run: |
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" quay.io
GIT_BRANCH=$(echo "${GITHUB_REF}" | cut -d / -f 3)
echo "GIT_BRANCH is ${GIT_BRANCH} and GITHUB_REF is ${GITHUB_REF}"
GIT_TAG="latest"
if [[ "$GIT_BRANCH" != "master" ]]; then
GIT_TAG=${GIT_BRANCH}
fi
# Publish with tag name
echo "Publishing image ${IMAGE_NAME}:${GIT_TAG}"
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${GIT_TAG}"
docker push "${IMAGE_NAME}:${GIT_TAG}"
# and with specific sha-1
echo "Publishing image ${IMAGE_NAME}:${GIT_TAG}-${SHORT_SHA1}"
SHORT_SHA1=$(git rev-parse --short HEAD)
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${GIT_TAG}-${SHORT_SHA1}"
docker push "${IMAGE_NAME}:${GIT_TAG}-${SHORT_SHA1}"
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
30 changes: 30 additions & 0 deletions .github/workflows/pr-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright (c) 2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

name: PR check

on:
pull_request:

jobs:
build:

runs-on: ubuntu-latest

steps:

- name: Clone source code
uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Docker build
run: |
echo "Building image..."
docker build .
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2020 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# Red Hat, Inc. - initial API and implementation

FROM php:7.4-apache

RUN apt-get -y update \
&& apt-get install -y libicu-dev\
tree \
vim \
wget \
git \
libzip-dev \
zlib1g-dev \
zip \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl \
&& docker-php-ext-install zip mysqli pdo pdo_mysql \
&& chmod -R 777 /etc/apache2 /var/www /var/lib/apache2 /var/log \
&& chown -R www-data:www-data /var/www \
\
#change Apache configuration
\
&& sed -i "s/80/8080/g" /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf \
&& sed -i 's/\/var\/www\/html/\/projects/g' /etc/apache2/sites-available/000-default.conf \
&& sed -i 's/\/var\/www/\/projects/g' /etc/apache2/apache2.conf \
&& sed -i 's/None/All/g' /etc/apache2/sites-available/000-default.conf \
&& echo "ServerName localhost" | tee -a /etc/apache2/apache2.conf

#add composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

WORKDIR /projects

CMD sleep infinity
Loading

0 comments on commit 8de402c

Please sign in to comment.