Skip to content

Commit

Permalink
test composer 2, add some tests, update readme, update generated cont…
Browse files Browse the repository at this point in the history
…ainer files
  • Loading branch information
mik-p committed Oct 2, 2021
1 parent 729d42d commit bc34e50
Show file tree
Hide file tree
Showing 19 changed files with 116 additions and 45 deletions.
3 changes: 1 addition & 2 deletions Dockerfile.develop.template
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer

%%VARIANT_EXTRAS%%

Expand Down
3 changes: 1 addition & 2 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer

%%VARIANT_EXTRAS%%

Expand Down
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Based on [official docker PHP images](https://hub.docker.com/_/php), images incl
- `develop-php7.2-apache`, `develop`: [php7.2/apache/Dockerfile.develop](https://github.com/mik-p/docker-wintercms/blob/master/php7.2/apache/Dockerfile.develop)
- `develop-php7.2-fpm`: [php7.2/fpm/Dockerfile.develop](https://github.com/mik-p/docker-wintercms/blob/master/php7.2/fpm/Dockerfile.develop)

---

## Quick Start

To run Winter CMS using Docker, start a container using the latest image, mapping your local port 80 to the container's port 80:
Expand All @@ -52,6 +54,7 @@ $ docker rm winter # Destroys the container
- Hit `CTRL-C` to stop the container. Running a container in the foreground will send log outputs to your terminal.
- Run the container in the background by passing the `-d` option:

<br>

## Working with Local Files

Expand Down Expand Up @@ -88,6 +91,7 @@ $ docker-compose up -d # start services defined in `docker-compose.yml` in the b
$ docker-compose down # stop and destroy
```

<br>

## Database Support

Expand Down Expand Up @@ -145,6 +149,8 @@ $ docker-compose up -d
$ docker-compose exec web php artisan winter:up
```

<br>

## Cron

You can start a cron process by setting the environment variable `ENABLE_CRON` to `true`:
Expand Down Expand Up @@ -186,6 +192,8 @@ services:
- web
```

<br>

## Self Signed Certificates

Sometimes encyption is useful for testing. Self signed certs can be added by extending the image in another dockerfile:
Expand Down Expand Up @@ -238,6 +246,8 @@ services:
- MYSQL_ROOT_PASSWORD=root
```

<br>

## Command Line Tasks

Run the container in the background and launch an interactive shell (bash) for the container:
Expand Down Expand Up @@ -271,6 +281,7 @@ $ docker exec containername artisan plugin:install winter.user
$ docker exec -it containername tinker
```

<br>

## App Environment

Expand All @@ -280,7 +291,7 @@ On image build, a default `.env` is created and [config files](./config/docker)

> __Note__: Winter CMS settings stored in a site's database override the config. Active theme, mail configuration, and other settings which are saved in the database will ultimately override configuration values.
#### PHP configuration
### PHP configuration

Recommended settings for opcache and PHP are applied on image build.

Expand All @@ -297,8 +308,9 @@ Environment variables can be passed to both docker-compose and Winter CMS.
> Passing environment variables via Docker can be problematic in production. A `phpinfo()` call may leak secrets by outputting environment variables. Consider mounting a `.env` volume or copying it to the container directly.
<br>

#### Docker Entrypoint
### Docker Entrypoint

The following variables trigger actions run by the [entrypoint script](./docker-wn-entrypoint) at runtime.

Expand All @@ -320,7 +332,7 @@ The following variables trigger actions run by the [entrypoint script](./docker-
| XDEBUG_ENABLE | false | `true` enables the Xdebug PHP extension |
| XDEBUG_REMOTE_HOST | host.docker.internal | Override value for `xdebug.remote_host` in docker-xdebug-php.ini |

#### Winter CMS app environment config
### Winter CMS app environment config

List of variables used in `config/docker`

Expand Down
3 changes: 1 addition & 2 deletions php7.2/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer

RUN a2enmod rewrite

Expand Down
7 changes: 3 additions & 4 deletions php7.2/apache/Dockerfile.develop
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer

RUN a2enmod rewrite

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

ENV WINTERCMS_TAG develop
ENV WINTERCMS_DEVELOP_CHECKSUM 01b4c7d88a039e988cb650212fb9570eadb382c7
ENV WINTERCMS_DEVELOP_COMMIT affdcce339e0b0cece1952fac08af9ee74d2255c
ENV WINTERCMS_DEVELOP_CHECKSUM e6cad3d6a87a18f0ca80578c501546b3ec9cbb87
ENV WINTERCMS_DEVELOP_COMMIT 7aea162fe2f383e800c29f8130c67c182e7573bd

RUN git clone https://github.com/wintercms/winter.git -b $WINTERCMS_TAG . && \
composer install --no-interaction --prefer-dist --no-scripts && \
Expand Down
3 changes: 1 addition & 2 deletions php7.2/fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer



Expand Down
7 changes: 3 additions & 4 deletions php7.2/fpm/Dockerfile.develop
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer



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

ENV WINTERCMS_TAG develop
ENV WINTERCMS_DEVELOP_CHECKSUM 01b4c7d88a039e988cb650212fb9570eadb382c7
ENV WINTERCMS_DEVELOP_COMMIT affdcce339e0b0cece1952fac08af9ee74d2255c
ENV WINTERCMS_DEVELOP_CHECKSUM e6cad3d6a87a18f0ca80578c501546b3ec9cbb87
ENV WINTERCMS_DEVELOP_COMMIT 7aea162fe2f383e800c29f8130c67c182e7573bd

RUN git clone https://github.com/wintercms/winter.git -b $WINTERCMS_TAG . && \
composer install --no-interaction --prefer-dist --no-scripts && \
Expand Down
3 changes: 1 addition & 2 deletions php7.3/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer

RUN a2enmod rewrite

Expand Down
7 changes: 3 additions & 4 deletions php7.3/apache/Dockerfile.develop
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer

RUN a2enmod rewrite

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

ENV WINTERCMS_TAG develop
ENV WINTERCMS_DEVELOP_CHECKSUM 01b4c7d88a039e988cb650212fb9570eadb382c7
ENV WINTERCMS_DEVELOP_COMMIT affdcce339e0b0cece1952fac08af9ee74d2255c
ENV WINTERCMS_DEVELOP_CHECKSUM e6cad3d6a87a18f0ca80578c501546b3ec9cbb87
ENV WINTERCMS_DEVELOP_COMMIT 7aea162fe2f383e800c29f8130c67c182e7573bd

RUN git clone https://github.com/wintercms/winter.git -b $WINTERCMS_TAG . && \
composer install --no-interaction --prefer-dist --no-scripts && \
Expand Down
3 changes: 1 addition & 2 deletions php7.3/fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer



Expand Down
7 changes: 3 additions & 4 deletions php7.3/fpm/Dockerfile.develop
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer



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

ENV WINTERCMS_TAG develop
ENV WINTERCMS_DEVELOP_CHECKSUM 01b4c7d88a039e988cb650212fb9570eadb382c7
ENV WINTERCMS_DEVELOP_COMMIT affdcce339e0b0cece1952fac08af9ee74d2255c
ENV WINTERCMS_DEVELOP_CHECKSUM e6cad3d6a87a18f0ca80578c501546b3ec9cbb87
ENV WINTERCMS_DEVELOP_COMMIT 7aea162fe2f383e800c29f8130c67c182e7573bd

RUN git clone https://github.com/wintercms/winter.git -b $WINTERCMS_TAG . && \
composer install --no-interaction --prefer-dist --no-scripts && \
Expand Down
3 changes: 1 addition & 2 deletions php7.4/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer

RUN a2enmod rewrite

Expand Down
7 changes: 3 additions & 4 deletions php7.4/apache/Dockerfile.develop
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer

RUN a2enmod rewrite

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

ENV WINTERCMS_TAG develop
ENV WINTERCMS_DEVELOP_CHECKSUM 01b4c7d88a039e988cb650212fb9570eadb382c7
ENV WINTERCMS_DEVELOP_COMMIT affdcce339e0b0cece1952fac08af9ee74d2255c
ENV WINTERCMS_DEVELOP_CHECKSUM e6cad3d6a87a18f0ca80578c501546b3ec9cbb87
ENV WINTERCMS_DEVELOP_COMMIT 7aea162fe2f383e800c29f8130c67c182e7573bd

RUN git clone https://github.com/wintercms/winter.git -b $WINTERCMS_TAG . && \
composer install --no-interaction --prefer-dist --no-scripts && \
Expand Down
3 changes: 1 addition & 2 deletions php7.4/fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer



Expand Down
7 changes: 3 additions & 4 deletions php7.4/fpm/Dockerfile.develop
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ RUN { \

ENV COMPOSER_ALLOW_SUPERUSER=1

RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer && \
/usr/local/bin/composer global require hirak/prestissimo
RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/local/bin --filename=composer



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

ENV WINTERCMS_TAG develop
ENV WINTERCMS_DEVELOP_CHECKSUM 01b4c7d88a039e988cb650212fb9570eadb382c7
ENV WINTERCMS_DEVELOP_COMMIT affdcce339e0b0cece1952fac08af9ee74d2255c
ENV WINTERCMS_DEVELOP_CHECKSUM e6cad3d6a87a18f0ca80578c501546b3ec9cbb87
ENV WINTERCMS_DEVELOP_COMMIT 7aea162fe2f383e800c29f8130c67c182e7573bd

RUN git clone https://github.com/wintercms/winter.git -b $WINTERCMS_TAG . && \
composer install --no-interaction --prefer-dist --no-scripts && \
Expand Down
28 changes: 28 additions & 0 deletions test/init_plugins.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash -e

TEST_ROOT=test
SOURCE_ROOT=..

if [ "$(basename $(pwd))" != "$TEST_ROOT" ]; then
echo "test run in wrong directory"
exit 1
fi

TEST_CONTAINER_NAME=test-wn-init-plugins
TEST_CONTAINER_TYPE=$SOURCE_ROOT/php7.4/apache

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

echo "run test container"
docker run \
-it \
--rm \
-p 8888:80 \
-e INIT_PLUGINS=true \
$TEST_CONTAINER_NAME \
bash -c "echo 'container test run complete'; exit 0" || exit 1

echo "test done"

exit 0
30 changes: 30 additions & 0 deletions test/init_winter.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash -e

TEST_ROOT=test
SOURCE_ROOT=..

if [ "$(basename $(pwd))" != "$TEST_ROOT" ]; then
echo "test run in wrong directory"
exit 1
fi

TEST_CONTAINER_NAME=test-wn-init-winter
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

echo "run test container"
docker run \
-it \
--rm \
-p 8888:80 \
-e INIT_WINTER=true \
$TEST_CONTAINER_NAME \
bash -c "echo 'container test run complete'; exit 0" || exit 1

echo "test done"

exit 0
15 changes: 15 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ while true; do
--force) FORCE=1; shift ;;
--push) PUSH=1; shift ;;
--rewrite) REWRITE_ONLY=1; shift ;;
-h) HELP_MSG=1; shift ;;
*)
break
esac
Expand All @@ -240,6 +241,20 @@ done
### Run

echo "Automat: `date`"
echo ""
echo "usage: ./update.sh [options]"
echo ""
echo "options:"
echo "-h this message"
echo ""
echo "--force force the process"
echo "--push push the changes to source repository"
echo "--rewrite only rewrite the local files"
echo ""

[ "$HELP_MSG" ] && exit 0

echo "starting update:"

[ "$PUSH" ] && echo ' - Commit changes'
# Load cached version if not forced
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_DEVELOP_COMMIT=affdcce339e0b0cece1952fac08af9ee74d2255c
WINTERCMS_DEVELOP_CHECKSUM=01b4c7d88a039e988cb650212fb9570eadb382c7
WINTERCMS_DEVELOP_COMMIT=7aea162fe2f383e800c29f8130c67c182e7573bd
WINTERCMS_DEVELOP_CHECKSUM=e6cad3d6a87a18f0ca80578c501546b3ec9cbb87

0 comments on commit bc34e50

Please sign in to comment.