-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: "0 4 * * *" | ||
|
||
jobs: | ||
build: | ||
name: Build Container | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
version: [ v1.23, v1.22 ] | ||
steps: | ||
- | ||
name: Checkout code | ||
uses: actions/checkout@v3 | ||
- | ||
name: Install composer | ||
uses: php-actions/composer@v6 | ||
- | ||
name: Docker info | ||
run: docker info | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
- | ||
name: "ddev ${{ matrix.version }}" | ||
shell: 'script -q -e -c "bash {0}"' | ||
run: ./build.sh -v ${{ matrix.version }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
ddev-initialize: | ||
stage: project-template-test | ||
image: ochorocho/ochorocho/ddev-docker:v1.23.1 | ||
services: | ||
- name: docker:dind | ||
when: always | ||
script: | ||
- su ddev -c "ddev --version" | ||
- su ddev -c "ddev typo3-init" | ||
- su ddev -c "ddev restart" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM docker:latest | ||
|
||
ARG ddev_version | ||
ENV DDEV_VERSION=${ddev_version} | ||
|
||
COPY ddev-install.sh ddev-install.sh | ||
RUN ash ddev-install.sh | ||
USER ddev | ||
RUN mkcert -install |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# DDEV Docker in Docker (dind) | ||
|
||
|
||
# ddev-docker |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/usr/bin/env bash | ||
|
||
GITHUB_OWNER=ddev | ||
PUSH="" | ||
IMAGE_NAME="ochorocho/ddev-docker" | ||
DDEV_VERSION="" | ||
|
||
# @todo: | ||
# * Allow version v1.23 -> v1.23 | ||
# * --push --load options | ||
# * Use bats for tests?! | ||
|
||
help() { | ||
echo "Available options:" | ||
echo " * v - DDEV version e.g. 'v1.23.1'" | ||
echo " * l - Load the image (--load)" | ||
echo " * p - Push the image (--push)" | ||
} | ||
|
||
loadVersionAndTags() { | ||
# @todo: Currently limited to 99 releases, may use pagination | ||
ddev_releases=($(curl --silent -L -H "Accept: application/vnd.github+json" https://api.github.com/repos/${GITHUB_OWNER}/ddev/releases?per_page=99 | jq -r '.[].tag_name')) | ||
|
||
IFS='.' read -r -a version <<< "$OPTION_VERSION" | ||
bugfix_release="${version[2]}" | ||
|
||
if [[ "${version[2]}" == "" ]]; then | ||
bugfix_release="[0-9]+" | ||
# Add minor tag version. In cas only major.minor is given, it will be tagged as well | ||
additional_tag="${version[0]}.${version[1]}" | ||
fi | ||
|
||
pattern="^${version[0]}\.${version[1]}\.${bugfix_release}$" | ||
filtered_array=() | ||
|
||
for element in "${ddev_releases[@]}"; do | ||
if [[ $element =~ $pattern ]]; then | ||
filtered_array+=("$element") | ||
fi | ||
done | ||
|
||
DDEV_VERSION="${filtered_array[0]}" | ||
|
||
# Define image tags | ||
if [[ $additional_tag == "" ]]; then | ||
DOCKER_TAGS=("-t $IMAGE_NAME:${DDEV_VERSION}") | ||
else | ||
DOCKER_TAGS=("-t $IMAGE_NAME:$additional_tag" "-t $IMAGE_NAME:$DDEV_VERSION") | ||
fi | ||
} | ||
|
||
while getopts ":v:h:p" opt; do | ||
case $opt in | ||
h) | ||
help | ||
exit 1 | ||
;; | ||
v) | ||
OPTION_VERSION="${OPTARG}" | ||
;; | ||
p) | ||
PUSH="--push" | ||
;; | ||
*) | ||
echo "Invalid option: -$OPTARG" | ||
help | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
loadVersionAndTags | ||
|
||
docker build --progress plain --platform linux/amd64,linux/arm64 --no-cache --pull . -f Dockerfile ${DOCKER_TAGS[@]} --build-arg ddev_version="$DDEV_VERSION" --load $PUSH && \ | ||
docker run --rm -it -v "$(pwd)/test.sh:/tmp/test.sh" --entrypoint "ash" "$IMAGE_NAME:$DDEV_VERSION" /tmp/test.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/ash | ||
|
||
apk add bash sudo | ||
adduser -D ddev -g "ddev" -s /bin/bash -D ddev -h /home/ddev | ||
echo "ddev ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ddev && chmod 0440 /etc/sudoers.d/ddev | ||
unamearch=$(uname -m) | ||
case ${unamearch} in | ||
x86_64) ARCH="amd64"; | ||
;; | ||
aarch64) ARCH="arm64"; | ||
;; | ||
arm64) ARCH="arm64" | ||
;; | ||
*) printf "${RED}Sorry, your machine architecture ${unamearch} is not currently supported.\n${RESET}" && exit 106 | ||
;; | ||
esac | ||
|
||
echo "https://github.com/ddev/ddev/releases/download/${DDEV_VERSION}/ddev_linux-${ARCH}.${DDEV_VERSION}.tar.gz" | ||
|
||
wget "https://github.com/ddev/ddev/releases/download/${DDEV_VERSION}/ddev_linux-${ARCH}.${DDEV_VERSION}.tar.gz" | ||
tar xfvz "ddev_linux-${ARCH}.${DDEV_VERSION}.tar.gz" | ||
mv ddev /usr/local/bin/ | ||
|
||
# Ensure required folders exist | ||
mkdir -p /home/ddev/.ddev/commands/host | ||
chown -R ddev:ddev /home/ddev/.ddev/ | ||
|
||
# Install mkcert | ||
wget "https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-${ARCH}" | ||
mv "mkcert-v1.4.4-linux-${ARCH}" /usr/local/bin/mkcert | ||
chmod +x /usr/local/bin/mkcert |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
docker --version | head -n 1 || exit 1 | ||
docker-compose --version | head -n 1 || exit 1 | ||
ddev --version | head -n 1 || exit 1 | ||
mkcert -version | ||
echo "Current user: $(whoami)" |