Skip to content
Merged
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ dockerfile
docker-compose.yml
README.md
LICENSE.txt
public/cache
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
run: docker compose logs

- name: Run linting inside app container
run: docker compose run --rm -T findingaid /vendor/bin/phpcs -w --exclude=Generic.Files.LineLength --standard=PSR12 /tests /app
run: docker compose run --rm -T findingaid /opt/findingaid/vendor/bin/phpcs -w --exclude=Generic.Files.LineLength --standard=PSR12 /opt/findingaid/tests /opt/findingaid/app

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

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

- name: Teardown
if: always()
Expand Down
33 changes: 19 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ RUN apk add --no-cache \
COPY --from=composer:2.8 /usr/bin/composer /usr/bin/composer
COPY --from=jsmin /usr/bin/jsmin /usr/bin/jsmin

WORKDIR /
WORKDIR /opt/findingaid

COPY ./composer.json .
COPY ./composer.lock .

RUN composer install --no-interaction

COPY exe/build.sh /exe/build.sh
COPY /exe ./exe

COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
Expand All @@ -49,10 +49,6 @@ COPY ./composer.lock .

RUN composer install --no-interaction --no-dev

WORKDIR /app

COPY ./app .

FROM php:8.3-fpm-alpine AS ci

RUN apk add --no-cache \
Expand All @@ -62,11 +58,11 @@ RUN apk add --no-cache \
WORKDIR /app

COPY --from=jsmin /usr/bin/jsmin /usr/bin/jsmin
COPY --from=prod-builder /app .
COPY --from=development /vendor /vendor
COPY ./phpunit.xml /phpunit.xml
COPY --from=development /opt/findingaid/vendor /opt/findingaid/vendor
COPY ./phpunit.xml /opt/findingaid/phpunit.xml
COPY /app .

COPY exe/build.sh /exe/build.sh
COPY exe/build.sh /opt/findingaid/exe/build.sh
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

Expand All @@ -76,15 +72,24 @@ CMD ["php-fpm", "-F"]

FROM php:8.3-fpm-alpine AS production

WORKDIR /app
RUN apk add --no-cache \
libzip-dev \
bash

COPY --from=jsmin /usr/bin/jsmin /usr/bin/jsmin
COPY --from=prod-builder /composer/vendor /opt/findingaid/vendor

COPY --from=prod-builder /app .
COPY --from=prod-builder /composer/vendor /vendor
WORKDIR /opt/findingaid

COPY ./app ./app
COPY ./public ./public
COPY ./exe ./exe

COPY exe/build.sh /exe/build.sh
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

RUN ./exe/build.sh

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
EXPOSE 9000
CMD ["php-fpm", "-F"]
35 changes: 3 additions & 32 deletions docker-compose.ci.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,6 @@ services:
findingaid:
build:
context: .
target: CI
volumes:
- ./app:/app
- ./public:/public
- cache:/public/cache
- ./xml:/xml
- vendor:/vendor
- ./tests:/tests
networks:
- app_net

web:
image: nginx:1.29.0
ports:
- 8080:80
volumes:
- ./app:/app
- ./public:/public
- cache:/public/cache
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
networks:
- app_net
depends_on:
- findingaid

networks:
app_net:
driver: bridge

volumes:
vendor:
cache:
target: ci
environment:
APP_ENV: ci
11 changes: 11 additions & 0 deletions docker-compose.dev.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
findingaid:
build:
target: development
environment:
APP_ENV: development
develop:
watch:
- action: restart
path: ./app/assets/js
target: /opt/findingaid/app/assets/js
24 changes: 11 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ services:
findingaid:
build:
context: .
target: development
volumes:
- ./app:/app
- ./public:/public
- cache:/public/cache
- ./xml:/xml
- vendor:/vendor
- ./app:/opt/findingaid/app
- ./public:/opt/findingaid/public
- ./xml:/opt/findingaid/xml
- ./tests:/opt/findingaid/tests
- ./phpunit.xml:/opt/findingaid/phpunit.xml
networks:
- app_net

Expand All @@ -17,19 +16,18 @@ services:
ports:
- 8080:80
volumes:
- ./app:/app
- ./public:/public
- cache:/public/cache
- ./app:/opt/findingaid/app
- ./public:/opt/findingaid/public
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
networks:
- app_net
depends_on:
- findingaid

volumes:
app:
public:

networks:
app_net:
driver: bridge

volumes:
vendor:
cache:
8 changes: 6 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
set -eu
PUBLIC_DIR="/public"
PUBLIC_DIR="/opt/findingaid/public"
CACHE_DIR="$PUBLIC_DIR/cache"

chmod 755 "$PUBLIC_DIR"
Expand All @@ -11,6 +11,10 @@ chown -R www-data:www-data "$CACHE_DIR"
find "$CACHE_DIR" -type d -exec chmod 2775 "{}" \;
find "$CACHE_DIR" -type f -exec chmod 0664 "{}" \;

bash /exe/build.sh
# APP_ENV set in compose file
if [ "${APP_ENV:-}" = "development" ]; then
echo "Building js for dev"
bash /opt/findingaid/exe/build.sh
fi

exec "$@"
2 changes: 1 addition & 1 deletion nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ server {
listen 80;
server_name localhost;

root /public;
root /opt/findingaid/public;
index index.php;

location / {
Expand Down
Loading