Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions .env.ci
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,7 @@
# production, development, or ci
APP_ENV="ci"

# Omeka Database Information
DB_HOST="db"
DB_PREFIX="omeka_"
DB_CHARSET="utf8"
DB_PORT="3306"

# Versions of the EUK and FA services
EUK_TAG="latest"
FA_TAG="latest"

PROJECT_ROOT="."

# SQL Container
MYSQL_ROOT_PASSWORD="rootpassword"
MYSQL_USER="omeka_user"
MYSQL_PASSWORD="omeka_password"
MYSQL_DATABASE="omeka"

# Locations
SOLR_URL="url/to/solr/instance"
FA_BASE_URL="/fa/findingaid/?id="
DIP_STORE_BASE_URL="/dips"
20 changes: 4 additions & 16 deletions .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,7 @@
# production or development
APP_ENV="development"

# Omeka Database Information
DB_HOST="db"
DB_PREFIX="omeka_"
DB_CHARSET="utf8"
DB_PORT="3306"

# Versions of the EUK and FA services
EUK_TAG="latest"
FA_TAG="latest"

PROJECT_ROOT="."

MYSQL_ROOT_PASSWORD="rootpassword"
MYSQL_USER="omeka_user"
MYSQL_PASSWORD="omeka_password"
MYSQL_DATABASE="omeka"
SOLR_URL="url/to/solr"
FA_BASE_URL="/fa/findingaid/?id="
# /dips/ or /dipstest/
DIP_STORE_BASE_URL="/dips/"
14 changes: 1 addition & 13 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
# Target Environment
# production or development
APP_ENV="production"

# Omeka Database Information
DB_HOST="db"
DB_PREFIX="omeka"
DB_CHARSET="utf8"
DB_PORT="3306"

# Versions of the EUK and FA services
EUK_TAG="latest"
FA_TAG="latest"

PROJECT_ROOT="."
APP_ENV="development"

SOLR_URL="url/to/solr/instance"
FA_BASE_URL="/fa/findingaid/?id="
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: docker compose logs

- name: Container runs
run: docker compose run --rm --no-deps -T omeka php -v
run: docker compose run --rm --no-deps -T exploreuk php -v

- name: Teardown
if: always()
Expand All @@ -43,7 +43,7 @@ jobs:
run: docker compose logs

- name: Run linting inside app container
run: docker compose run --rm -T omeka /vendor/bin/phpcs -w --exclude=Generic.Files.LineLength --standard=PSR12 /tests /app/catalog.php /app/application/libraries/ExploreUK
run: docker compose run --rm -T exploreuk /vendor/bin/phpcs -w --exclude=Generic.Files.LineLength --standard=PSR12 /tests /app/catalog.php /app/application/libraries/ExploreUK

- name: Teardown
if: always()
Expand All @@ -63,14 +63,14 @@ jobs:
run: docker compose build

- name: Start services
run: docker compose up -d db omeka
run: docker compose up -d exploreuk

- name: Show service logs if failed
if: failure()
run: docker compose logs

- name: Run tests inside app container
run: docker compose run --rm -T omeka /vendor/bin/phpunit -c /phpunit.xml /tests
run: docker compose run --rm -T exploreuk /vendor/bin/phpunit -c /phpunit.xml /tests

- name: Teardown
if: always()
Expand Down
75 changes: 1 addition & 74 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,12 @@
FROM php:8.3-fpm-alpine AS builder

RUN apk add --no-cache \
git \
zip \
unzip \
rsync \
bash \
nodejs \
npm

WORKDIR /app

# Install Omeka
ADD "https://github.com/omeka/Omeka/releases/download/v3.1.2/omeka-3.1.2.zip" /tmp/omeka.zip

RUN unzip /tmp/omeka.zip -d /tmp/omeka-unzipped && \
mv /tmp/omeka-unzipped/omeka-3.1.2/* . && \
mv /tmp/omeka-unzipped/omeka-3.1.2/.htaccess . && \
rm -rf /tmp/omeka-unzipped

# Wipe out existing plugins if they exist and use the pinned versions from github
RUN rm -rf ./plugins/HideElements && \
rm -rf ./plugins/SimplePages

ADD "https://github.com/zerocrates/HideElements/releases/download/v1.4/HideElements-1.4.zip" /tmp/HideElements.zip
ADD "https://github.com/omeka/plugin-SimplePages/releases/download/v3.2.1/SimplePages-3.2.1.zip" /tmp/SimplePages.zip

RUN unzip /tmp/HideElements.zip -d ./plugins \
&& rm /tmp/HideElements.zip
RUN unzip /tmp/SimplePages.zip -d ./plugins \
&& rm /tmp/SimplePages.zip

# Install application and any necesary packages.

COPY ./app/package.json .
Expand All @@ -45,29 +21,9 @@ RUN npm run minify-css
FROM php:8.3-fpm-alpine AS development

RUN apk add --no-cache \
procps \
git \
zip \
unzip \
libgomp \
imagemagick \
imagemagick-dev \
rsync \
wget \
bash \
nodejs \
npm \
# adds packages to build extensions
$PHPIZE_DEPS \
libzip-dev \
libpng-dev \
jpeg-dev \
freetype-dev

RUN docker-php-ext-configure gd --with-freetype --with-jpeg && \
docker-php-ext-install -j$(nproc) gd pdo pdo_mysql mysqli zip exif

RUN pecl install imagick && docker-php-ext-enable imagick
npm

COPY --from=builder /app /app

Expand All @@ -90,9 +46,6 @@ CMD ["php-fpm", "-F"]

FROM php:8.3-fpm-alpine AS ci

RUN apk add --no-cache \
rsync

COPY --from=builder /app /app

WORKDIR /
Expand All @@ -119,32 +72,6 @@ CMD ["php-fpm", "-F"]

FROM php:8.3-fpm-alpine AS production

RUN apk add --no-cache rsync \
imagemagick \
jpeg \
libpng \
libzip \
libgomp \
su-exec

# virtual will add these build dependencies and then delete them after build, keeping the image size small
RUN apk add --no-cache --virtual .build-deps\
# adds packages to build extensions
$PHPIZE_DEPS \
pkgconfig \
imagemagick-dev \
zlib-dev \
libpng-dev \
jpeg-dev \
freetype-dev \
libzip-dev \
autoconf \
build-base \
rsync && \
docker-php-ext-install -j$(nproc) gd pdo pdo_mysql mysqli zip exif && \
pecl install imagick && docker-php-ext-enable imagick && \
apk del .build-deps

WORKDIR /app

COPY --from=builder /app .
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help dev dev-fa build down test lint lint-fix logs test-watch omeka-sh web-sh db-sh
.PHONY: help dev dev-fa build down test lint lint-fix logs test-watch exploreuk-sh web-sh db-sh

help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
Expand All @@ -16,13 +16,13 @@ down: ## Stop all containers
docker compose down

test: ## Run PHPUnit tests
docker compose exec omeka /vendor/bin/phpunit -c /phpunit.xml /tests
docker compose exec exploreuk /vendor/bin/phpunit -c /phpunit.xml /tests

lint: ## Run PHP_CodeSniffer (PSR-12)
docker compose exec omeka /vendor/bin/phpcs -w --exclude=Generic.Files.LineLength --standard=PSR12 /tests /app/catalog.php /app/application/libraries/ExploreUK
docker compose exec exploreuk /vendor/bin/phpcs -w --exclude=Generic.Files.LineLength --standard=PSR12 /tests /app/catalog.php /app/application/libraries/ExploreUK

lint-fix: ## Auto-fix PHP_CodeSniffer violations (PSR-12)
docker compose exec omeka /vendor/bin/phpcbf --exclude=Generic.Files.LineLength --standard=PSR12 /tests /app/catalog.php /app/application/libraries/ExploreUK
docker compose exec exploreuk /vendor/bin/phpcbf --exclude=Generic.Files.LineLength --standard=PSR12 /tests /app/catalog.php /app/application/libraries/ExploreUK

check: ## Run linter and tests reports
make lint
Expand All @@ -34,8 +34,8 @@ logs: ## Tail container logs
test-watch: ## Run tests on each file change (requires: watchexec)
watchexec -w app -w tests --no-process-group 'make test'

omeka-sh: ## Shell into the omeka container
docker compose exec omeka sh
exploreuk-sh: ## Shell into the exploreuk container
docker compose exec exploreuk sh

web-sh: ## Shell into the web container
docker compose exec web sh
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# ExploreUK

This is the main portion of the ExploreUK web application. Document data is
pulled from [Solr](https://solr.apache.org/), and other settings are managed in
the [Omeka Classic](https://omeka.org/classic/) admin panel. Deploying to
production is managed in the
pulled from [Solr](https://solr.apache.org/). Deploying to production is managed
in the
[ukl-ansible-playbooks](https://github.com/uklibraries/ukl-ansible-playbooks)
repository.

Expand All @@ -23,10 +22,10 @@ make dev

The application should then be available at http://localhost:8080. Developers
should run `make help` to see helper commands through
[make](https://www.gnu.org/software/make/). There are
[git submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) and a
mysql database that is loaded on initialization in the `assets` directory, so
new developers do not need to source assets for installation.
[make](https://www.gnu.org/software/make/). There is a
[git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) that is
loaded on initialization in the `assets` directory, so new developers do not
need to source assets for installation.

### Dependencies

Expand Down
Loading