Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add build dir argument #711

Closed
wants to merge 1 commit into from
Closed
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
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ FROM dunglas/frankenphp:1-php8.3 AS frankenphp_upstream
# https://docs.docker.com/compose/compose-file/#target


ARG BUILD_DIR=.
# Base FrankenPHP image
FROM frankenphp_upstream AS frankenphp_base

Expand Down Expand Up @@ -41,9 +42,9 @@ ENV PHP_INI_SCAN_DIR=":$PHP_INI_DIR/app.conf.d"
###> recipes ###
###< recipes ###

COPY --link frankenphp/conf.d/10-app.ini $PHP_INI_DIR/app.conf.d/
COPY --link --chmod=755 frankenphp/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
COPY --link frankenphp/Caddyfile /etc/caddy/Caddyfile
COPY --link $BUILD_DIR/frankenphp/conf.d/10-app.ini $PHP_INI_DIR/app.conf.d/
COPY --link --chmod=755 $BUILD_DIR/frankenphp/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
COPY --link $BUILD_DIR/frankenphp/Caddyfile /etc/caddy/Caddyfile

ENTRYPOINT ["docker-entrypoint"]

Expand Down Expand Up @@ -74,8 +75,8 @@ ENV FRANKENPHP_CONFIG="import worker.Caddyfile"

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

COPY --link frankenphp/conf.d/20-app.prod.ini $PHP_INI_DIR/app.conf.d/
COPY --link frankenphp/worker.Caddyfile /etc/caddy/worker.Caddyfile
COPY --link $BUILD_DIR/frankenphp/conf.d/20-app.prod.ini $PHP_INI_DIR/app.conf.d/
COPY --link $BUILD_DIR/frankenphp/worker.Caddyfile /etc/caddy/worker.Caddyfile

# prevent the reinstallation of vendors at every changes in the source code
COPY --link composer.* symfony.* ./
Expand All @@ -84,7 +85,7 @@ RUN set -eux; \

# copy sources
COPY --link . ./
RUN rm -Rf frankenphp/
RUN rm -Rf "$BUILD_DIR"/frankenphp/

RUN set -eux; \
mkdir -p var/cache var/log; \
Expand Down
15 changes: 15 additions & 0 deletions docs/custom-directory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Specifiy Build directory

If you want to place this repository in a subdirectory you can specify the `BUILD_ARGS` in your `compose.prod.yaml` AND `compose.override.yaml`.

```yaml
services:
php:
build:
context: . # <-- Adapt the context to the root level of your project
target: frankenphp_dev
args:
BUILD_DIR: "docker" # <-- Specifiy the subdirectory where this repository is placed
volumes:
- ./:/app # <-- Adapt the mount volume to the directory specified
```
Loading