Skip to content

Commit

Permalink
add a command line option to set a git tag as the build target instea…
Browse files Browse the repository at this point in the history
…d of 'latest'
  • Loading branch information
Pritchard, Michael (A&F, Black Mountain) authored and Pritchard, Michael (A&F, Black Mountain) committed Nov 1, 2021
1 parent 46866f6 commit b511b40
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 31 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Docker + Winter CMS

[![Docker Hub Pulls](https://img.shields.io/docker/pulls/hiltonbanes/wintercms.svg)](https://hub.docker.com/r/hiltonbanes/wintercms/) [![Winter CMS Build v1.0.474](https://img.shields.io/badge/Winter%20CMS%20Build-v1.0.474-red.svg)](https://github.com/wintercms/winter)
[![Docker Hub Pulls](https://img.shields.io/docker/pulls/hiltonbanes/wintercms.svg)](https://hub.docker.com/r/hiltonbanes/wintercms/) [![Winter CMS Build v1.1.6](https://img.shields.io/badge/Winter%20CMS%20Build-v1.1.6-red.svg)](https://github.com/wintercms/winter)

The docker images defined in this repository serve as a starting point for [Winter CMS](https://wintercms.com) projects.

Expand All @@ -20,12 +20,12 @@ Based on [official docker PHP images](https://hub.docker.com/_/php), images incl

## Supported Tags

- `build.v1.0.474-php7.4-apache`, `php7.4-apache`: [php7.4/apache/Dockerfile](https://github.com/mik-p/docker-wintercms/blob/master/php7.4/apache/Dockerfile)
- `build.v1.0.474-php7.4-fpm`, `php7.4-fpm`: [php7.4/fpm/Dockerfile](https://github.com/mik-p/docker-wintercms/blob/master/php7.4/fpm/Dockerfile)
- `build.v1.0.474-php7.3-apache`, `php7.3-apache`: [php7.3/apache/Dockerfile](https://github.com/mik-p/docker-wintercms/blob/master/php7.3/apache/Dockerfile)
- `build.v1.0.474-php7.3-fpm`, `php7.3-fpm`: [php7.3/fpm/Dockerfile](https://github.com/mik-p/docker-wintercms/blob/master/php7.3/fpm/Dockerfile)
- `build.v1.0.474-php7.2-apache`, `php7.2-apache`, `build.v1.0.474`, `latest`: [php7.2/apache/Dockerfile](https://github.com/mik-p/docker-wintercms/blob/master/php7.2/apache/Dockerfile)
- `build.v1.0.474-php7.2-fpm`, `php7.2-fpm`: [php7.2/fpm/Dockerfile](https://github.com/mik-p/docker-wintercms/blob/master/php7.2/fpm/Dockerfile)
- `build.v1.1.6-php7.4-apache`, `php7.4-apache`: [php7.4/apache/Dockerfile](https://github.com/mik-p/docker-wintercms/blob/master/php7.4/apache/Dockerfile)
- `build.v1.1.6-php7.4-fpm`, `php7.4-fpm`: [php7.4/fpm/Dockerfile](https://github.com/mik-p/docker-wintercms/blob/master/php7.4/fpm/Dockerfile)
- `build.v1.1.6-php7.3-apache`, `php7.3-apache`: [php7.3/apache/Dockerfile](https://github.com/mik-p/docker-wintercms/blob/master/php7.3/apache/Dockerfile)
- `build.v1.1.6-php7.3-fpm`, `php7.3-fpm`: [php7.3/fpm/Dockerfile](https://github.com/mik-p/docker-wintercms/blob/master/php7.3/fpm/Dockerfile)
- `build.v1.1.6-php7.2-apache`, `php7.2-apache`, `build.v1.1.6`, `latest`: [php7.2/apache/Dockerfile](https://github.com/mik-p/docker-wintercms/blob/master/php7.2/apache/Dockerfile)
- `build.v1.1.6-php7.2-fpm`, `php7.2-fpm`: [php7.2/fpm/Dockerfile](https://github.com/mik-p/docker-wintercms/blob/master/php7.2/fpm/Dockerfile)


### Develop Tags
Expand Down
6 changes: 3 additions & 3 deletions php7.2/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ RUN a2enmod rewrite

COPY config/docker /usr/src/wintercms-config-docker

ENV WINTERCMS_TAG v1.0.474
ENV WINTERCMS_CHECKSUM 5196ccd82d81c79667869056a2b7e27dc34a38a1
ENV WINTERCMS_CORE_BUILD v1.0.474
ENV WINTERCMS_TAG v1.1.6
ENV WINTERCMS_CHECKSUM ae7903d9f5ac0b67c12d804db6adc0f2f9c494a8
ENV WINTERCMS_CORE_BUILD v1.1.6

RUN git clone https://github.com/wintercms/winter.git -b $WINTERCMS_TAG --depth 1 . && \
echo "Update composer.json: Set explicit build references for winter module dependencies" && \
Expand Down
6 changes: 3 additions & 3 deletions php7.2/fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/l

COPY config/docker /usr/src/wintercms-config-docker

ENV WINTERCMS_TAG v1.0.474
ENV WINTERCMS_CHECKSUM 5196ccd82d81c79667869056a2b7e27dc34a38a1
ENV WINTERCMS_CORE_BUILD v1.0.474
ENV WINTERCMS_TAG v1.1.6
ENV WINTERCMS_CHECKSUM ae7903d9f5ac0b67c12d804db6adc0f2f9c494a8
ENV WINTERCMS_CORE_BUILD v1.1.6

RUN git clone https://github.com/wintercms/winter.git -b $WINTERCMS_TAG --depth 1 . && \
echo "Update composer.json: Set explicit build references for winter module dependencies" && \
Expand Down
6 changes: 3 additions & 3 deletions php7.3/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ RUN a2enmod rewrite

COPY config/docker /usr/src/wintercms-config-docker

ENV WINTERCMS_TAG v1.0.474
ENV WINTERCMS_CHECKSUM 5196ccd82d81c79667869056a2b7e27dc34a38a1
ENV WINTERCMS_CORE_BUILD v1.0.474
ENV WINTERCMS_TAG v1.1.6
ENV WINTERCMS_CHECKSUM ae7903d9f5ac0b67c12d804db6adc0f2f9c494a8
ENV WINTERCMS_CORE_BUILD v1.1.6

RUN git clone https://github.com/wintercms/winter.git -b $WINTERCMS_TAG --depth 1 . && \
echo "Update composer.json: Set explicit build references for winter module dependencies" && \
Expand Down
6 changes: 3 additions & 3 deletions php7.3/fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/l

COPY config/docker /usr/src/wintercms-config-docker

ENV WINTERCMS_TAG v1.0.474
ENV WINTERCMS_CHECKSUM 5196ccd82d81c79667869056a2b7e27dc34a38a1
ENV WINTERCMS_CORE_BUILD v1.0.474
ENV WINTERCMS_TAG v1.1.6
ENV WINTERCMS_CHECKSUM ae7903d9f5ac0b67c12d804db6adc0f2f9c494a8
ENV WINTERCMS_CORE_BUILD v1.1.6

RUN git clone https://github.com/wintercms/winter.git -b $WINTERCMS_TAG --depth 1 . && \
echo "Update composer.json: Set explicit build references for winter module dependencies" && \
Expand Down
6 changes: 3 additions & 3 deletions php7.4/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ RUN a2enmod rewrite

COPY config/docker /usr/src/wintercms-config-docker

ENV WINTERCMS_TAG v1.0.474
ENV WINTERCMS_CHECKSUM 5196ccd82d81c79667869056a2b7e27dc34a38a1
ENV WINTERCMS_CORE_BUILD v1.0.474
ENV WINTERCMS_TAG v1.1.6
ENV WINTERCMS_CHECKSUM ae7903d9f5ac0b67c12d804db6adc0f2f9c494a8
ENV WINTERCMS_CORE_BUILD v1.1.6

RUN git clone https://github.com/wintercms/winter.git -b $WINTERCMS_TAG --depth 1 . && \
echo "Update composer.json: Set explicit build references for winter module dependencies" && \
Expand Down
6 changes: 3 additions & 3 deletions php7.4/fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/l

COPY config/docker /usr/src/wintercms-config-docker

ENV WINTERCMS_TAG v1.0.474
ENV WINTERCMS_CHECKSUM 5196ccd82d81c79667869056a2b7e27dc34a38a1
ENV WINTERCMS_CORE_BUILD v1.0.474
ENV WINTERCMS_TAG v1.1.6
ENV WINTERCMS_CHECKSUM ae7903d9f5ac0b67c12d804db6adc0f2f9c494a8
ENV WINTERCMS_CORE_BUILD v1.1.6

RUN git clone https://github.com/wintercms/winter.git -b $WINTERCMS_TAG --depth 1 . && \
echo "Update composer.json: Set explicit build references for winter module dependencies" && \
Expand Down
4 changes: 3 additions & 1 deletion test/composer_update.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ fi

TEST_CONTAINER_NAME=test-wn-composer-update
TEST_CONTAINER_TYPE=$SOURCE_ROOT/php7.4/apache
TEST_CONTAINER_DOCKERFILE=Dockerfile
# TEST_CONTAINER_DOCKERFILE=Dockerfile.develop

echo "build test"
docker build -t $TEST_CONTAINER_NAME $TEST_CONTAINER_TYPE || exit 1
docker build -t $TEST_CONTAINER_NAME $TEST_CONTAINER_TYPE -f $TEST_CONTAINER_TYPE/$TEST_CONTAINER_DOCKERFILE || exit 1

echo "run test container"
docker run \
Expand Down
18 changes: 15 additions & 3 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ if ! hash sha1sum 2>&-; then { if ! hash openssl 2>&-; then echo "Error: openssl
### Functions

function check_winter {

# CORE_HASH="$WINTERCMS_CORE_HASH";

# curl -X POST -fsS --connect-timeout 15 --url https://api.github.com/repos/wintercms/winter/releases/latest \
# -F "build=$CORE_BUILD" -F "core=$CORE_HASH" -F "plugins=a:0:{}" -F "server=$WINTERCMS_SERVER_HASH" -F "edge=$EDGE" \
# | jq '. | { build: .core.build, hash: .core.hash, update: .update, updates: .core.updates }' || exit 1

# curl -fsS --connect-timeout 15 https://api.github.com/repos/wintercms/winter/releases/latest | jq -r '. | { name: .name, tag: .tag_name, hash: $CORE_HASH}' || exit 1;
curl -fsS --connect-timeout 15 https://api.github.com/repos/wintercms/winter/releases/latest | jq -r '. | { name: .name, tag: .tag_name}' || exit 1;
if [ ! -z "$1" ]; then
# get a tag instead
curl -fsS --connect-timeout 15 https://api.github.com/repos/wintercms/winter/tags | jq --argjson tag_index $1 -r '.[$tag_index] | { name: .name, tag: .name }' || exit 1;
else
# curl -fsS --connect-timeout 15 https://api.github.com/repos/wintercms/winter/releases/latest | jq -r '. | { name: .name, tag: .tag_name, hash: $CORE_HASH}' || exit 1;
curl -fsS --connect-timeout 15 https://api.github.com/repos/wintercms/winter/releases/latest | jq -r '. | { name: .name, tag: .tag_name}' || exit 1;
fi
}

function update_checksum {
Expand Down Expand Up @@ -233,6 +239,7 @@ while true; do
--push) PUSH=1; shift ;;
--rewrite) REWRITE_ONLY=1; shift ;;
-h) HELP_MSG=1; shift ;;
-t) TAG_SELECT=1; shift ; GITHUB_LATEST_TAG_INDEX=$1; shift ;;
*)
break
esac
Expand All @@ -247,7 +254,9 @@ echo "usage: ./update.sh [options]"
echo ""
echo "options:"
echo "-h this message"
echo "-t tag [index]: select a git tag by index instead of latest stable"
echo ""
echo "commands:"
echo "--force force the process"
echo "--push push the changes to source repository"
echo "--rewrite only rewrite the local files"
Expand All @@ -257,13 +266,16 @@ echo ""

echo "starting update:"

[ "$TAG_SELECT" ] && echo " - latest tag shifted by index: $GITHUB_LATEST_TAG_INDEX"

[ "$PUSH" ] && echo ' - Commit changes'
# Load cached version if not forced
[ "$FORCE" ] && echo ' - Force update' || source version
[ "$REWRITE_ONLY" ] && echo ' - Rewriting Dockerfiles and README'

echo " - Querying Winter CMS repo for latest..."
LATEST_STABLE_RELEASE=$(check_winter)
LATEST_STABLE_RELEASE=$(check_winter $GITHUB_LATEST_TAG_INDEX)
echo $LATEST_STABLE_RELEASE

if [ $(echo "$LATEST_STABLE_RELEASE" | jq -r '.name') == $WINTERCMS_BUILD ]; then
STABLE_UPDATE=0
Expand Down
4 changes: 2 additions & 2 deletions version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WINTERCMS_BUILD=v1.0.474
WINTERCMS_CHECKSUM=5196ccd82d81c79667869056a2b7e27dc34a38a1
WINTERCMS_BUILD=v1.1.6
WINTERCMS_CHECKSUM=ae7903d9f5ac0b67c12d804db6adc0f2f9c494a8
WINTERCMS_DEVELOP_COMMIT=4847f8bc92b17c689f3ff163f4672ba7155362e4
WINTERCMS_DEVELOP_CHECKSUM=9f86e32a8f81d828039a7a4e7ede029be5be9dc2

0 comments on commit b511b40

Please sign in to comment.