Verified Commit 5fea54c3 authored by Christoph Böhner-Figas's avatar Christoph Böhner-Figas
Browse files

Add first working version

parent 5bbe0cdd
Pipeline #10576 passed with stage
in 1 minute and 57 seconds
image: docker:latest
services:
- docker:dind
stages:
- build
build:
stage: build
only:
refs:
- master
script:
- /bin/sh build.sh
# Drush Docker Container
FROM composer:1
# Add minimal dependencies.
RUN apk --no-cache add mysql-client mariadb-client \
&& docker-php-ext-install pdo_mysql \
&& rm -rf /var/cache/apk/*
# Install Drush using Composer
RUN composer global require drush/drush:"~8.1.0" --prefer-dist
# Setup the symlink
RUN ln -sf $COMPOSER_HOME/vendor/bin/drush.php /usr/local/bin/drush
# Add the site_audit module.
RUN drush @none dl registry_rebuild-7.x site_audit
# Display which version of Drush was installed
RUN drush --version
# Update the entry point of the application
ENTRYPOINT ["drush"]
# The official Drupal repository puts the Drupalroot at /var/www/html.
WORKDIR /app/web
......@@ -5,30 +5,42 @@
# Quick reference
The images are inspired by the recommended drupal drush images from docker hub. See [docker hub](https://hub.docker.com/r/drush/drush/)
for the official details.
The images are inspired by the recommended drupal drush images from docker hub. See [docker hub](https://hub.docker.com/r/drush/drush/) for the official details.
The image provides the following advantages over existing solutions:
* Installed additional packages: gettext pipenv
* Installed additional packages: mysql-client, mariadb-client
* Install drush via composer
* Workdir set to /app/web, following our convention to mount the project as /app
* Additional script python-install-requirements.sh: Helper script to install packages inside your
own Dockerfile using a requirements.txt. Usage: `python-install-requirements.sh <path-to-requirements>`
* Additional script python-install-pipfile.sh: Helper script to install packages inside your
own Dockerfile using a Pipfile. Usage: `python-install-pipfile.sh <pipfile-path>`
* Add Site Audit module (D8 only)
## Example usage (Django project)
## Example usage (Drupal project)
```yaml
version: '3'
services:
services:``
php:
image: docker.team23.de/docker/php-fpm:7.2
volumes:
# Add project as volume, too. So CLI scripts can be used…
- ./:/app/:cached
web:
image: docker.team23.de/docker/apache:2.4-php
volumes:
# Provide project path as /app. /app/web must exist, this means
# you mast have web/ inside your project.
- ./:/app/:cached
depends_on:
- php
ports:
- "8000:80"
drush:
build:
context: docker/drush
image: docker.team23.de/docker/drush:8.1
working_dir: "/app/web"
volumes:
- db:/var/lib/mysql/:delegated
- ../:/app:cached
links:
- db
```
\ No newline at end of file
```
#!/bin/bash
# Configuration
VERSIONS="8.1"
LATEST_VERSION="8.1"
# Let's do it
if [ -z "$CI_REGISTRY" ]
then # outside gitlab ci runner
docker login docker.team23.de
BUILD_PROJECT_NAME=$( basename $( pwd ) )
BUILD_IMAGE_BASE="docker.team23.de/docker/$BUILD_PROJECT_NAME"
else # inside gitlab ci runner
docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
BUILD_IMAGE_BASE="$CI_REGISTRY/$CI_PROJECT_PATH"
fi
for VERSION in $VERSIONS
do
# Copy shared files
# cp -rp shared/* "$VERSION/"
# Build Image
docker build --pull -t "$BUILD_IMAGE_BASE:$VERSION" "$VERSION"
docker push "$BUILD_IMAGE_BASE:$VERSION"
done
# Build latest image
docker build --pull -t "$BUILD_IMAGE_BASE:latest" "$LATEST_VERSION"
docker push "$BUILD_IMAGE_BASE:latest"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment