Skip to content

Commit

Permalink
Use Lagoon images
Browse files Browse the repository at this point in the history
  • Loading branch information
almunnings committed Feb 23, 2024
1 parent b022051 commit af5b125
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 218 deletions.
6 changes: 3 additions & 3 deletions .docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ There is a `docker-compose` stack here, it's mostly for reference and hosting th
Create a .env `cp .env.example .env` then fill in the database credentials.

```bash
docker-compose up
docker-compose exec -it php drush si --existing-config --account-name=admin -y
docker-compose up -d
docker-compose exec -it cli drush si --existing-config --account-name=admin -y
```

To expose the site on port 80, create a `docker-compose.override.yml` file with the following:
Expand All @@ -17,7 +17,7 @@ To expose the site on port 80, create a `docker-compose.override.yml` file with
services:
nginx:
ports:
- 80:80
- 80:8080
```
## Cleaning up
Expand Down
9 changes: 9 additions & 0 deletions .docker/cli.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM uselagoon/php-8.1-cli:latest

ENV WEBROOT web
ENV PATH "/app/vendor/bin:${PATH}"

COPY ./composer.* /app/
RUN composer install --no-dev --no-interaction --optimize-autoloader

COPY . /app
134 changes: 0 additions & 134 deletions .docker/nginx.conf

This file was deleted.

11 changes: 6 additions & 5 deletions .docker/nginx.dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
ARG PHP_IMAGE
FROM ${PHP_IMAGE} as php
ARG CLI_IMAGE
FROM ${CLI_IMAGE} as cli

FROM nginx:1-alpine
FROM uselagoon/nginx-drupal:latest

COPY .docker/nginx.conf /etc/nginx/conf.d/default.conf
ENV WEBROOT web
ENV BASIC_AUTH off

COPY --from=php /app /app
COPY --from=cli /app /app
33 changes: 4 additions & 29 deletions .docker/php.dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
FROM php:8.1-fpm-alpine
ARG CLI_IMAGE
FROM ${CLI_IMAGE} as cli

WORKDIR /app

ENV MEMCACHED_DEPS zlib-dev libmemcached-dev cyrus-sasl-dev
ENV COMPOSER_ALLOW_SUPERUSER 1

RUN set -xe \
&& apk add --no-cache --update --virtual .phpize-deps $PHPIZE_DEPS \
&& apk add --no-cache --update --virtual .memcached-deps $MEMCACHED_DEPS \
&& apk add --no-cache --update oniguruma-dev libpng-dev libwebp-dev jpeg-dev libjpeg-turbo-dev freetype-dev libmemcached-libs zlib mysql-client tzdata ca-certificates zip git bash \
&& update-ca-certificates \
&& docker-php-ext-configure gd --with-freetype --with-webp --with-jpeg \
&& docker-php-ext-install pdo_mysql mbstring opcache gd \
&& pecl install memcache \
&& docker-php-ext-enable memcache \
&& docker-php-source delete \
&& rm -rf /tmp/* /var/cache/* /usr/src/* \
&& ln -sf /app/vendor/bin/drush /usr/local/bin/drush \
&& apk del .memcached-deps .phpize-deps

COPY .docker/php.ini /usr/local/etc/php/conf.d/zzz-custom.ini

# Composer install all assets
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
COPY composer.json composer.lock ./
RUN composer install --no-dev --profile --no-interaction && composer clear-cache

# Copy application files
COPY . .
FROM uselagoon/php-8.1-fpm:latest

COPY --from=cli /app /app
22 changes: 0 additions & 22 deletions .docker/php.ini

This file was deleted.

8 changes: 7 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Default ignores
.git
.DS_Store
/vendor/
**/node_modules/
**/*.sql
Expand All @@ -10,3 +9,10 @@
# Volumes
/private/
**/web/sites/*/files/

# Trash
.DS_Store
Thumbs.db
ehthumbs.db
*.tmp
*.swp
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ node_modules
.lando.local.yml
/docker-compose.override.yml

# OS Annoyances
# Trash
.DS_Store
Thumbs.db
ehthumbs.db
*.tmp
*.swp

# Ignore files generated by editors
/.idea/
Expand Down
55 changes: 32 additions & 23 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,42 @@

x-volumes:
&default-volumes
volumes:
- ./private:/app/private:delegated
- ./web/sites/default/files:/app/web/sites/default/files:delegated

services:
cli:
image: &cli-image ${COMPOSE_PROJECT_NAME:-drupal}-cli
build:
context: .
dockerfile: .docker/cli.dockerfile
<<: *default-volumes
depends_on:
database:
condition: service_healthy
memcached:
condition: service_started

php:
build:
context: .
dockerfile: .docker/php.dockerfile
args:
CLI_IMAGE: *cli-image
<<: *default-volumes
depends_on:
- cli

nginx:
build:
context: .
dockerfile: .docker/nginx.dockerfile
args:
CLI_IMAGE: *cli-image
<<: *default-volumes
depends_on:
- cli

database:
image: mariadb:11.0
volumes:
Expand All @@ -25,27 +56,5 @@ services:
environment:
MEMCACHED_MAX_ITEM_SIZE: 8388608

php:
image: &php-image ${COMPOSE_PROJECT_NAME:-drupal}-php
build:
context: .
dockerfile: .docker/php.dockerfile
<<: *default-volumes
depends_on:
database:
condition: service_healthy
memcached:
condition: service_started

nginx:
build:
context: .
dockerfile: .docker/nginx.dockerfile
args:
PHP_IMAGE: *php-image
<<: *default-volumes
depends_on:
- php

volumes:
mariadb:

0 comments on commit af5b125

Please sign in to comment.