Add build context to compose (#680)

* Add build context to compose

Signed-off-by: Daniel Ekman <knegge@gmail.com>

* Update Docker documentation with build instructions

Enhance Docker deployment documentation by:
- Adding detailed instructions for building Docker images
- Providing two methods for image building (Docker Compose and manual)
- Clarifying how to use local images with docker-compose.override.yml

---------

Signed-off-by: Daniel Ekman <knegge@gmail.com>
Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Daniel Ekman 2025-01-28 12:56:01 +01:00 committed by GitHub
parent 735f398605
commit ae74f33a27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 1 deletions

View File

@ -2,6 +2,9 @@
services:
api: &api
image: jhumanj/opnform-api:latest
build:
context: .
dockerfile: docker/Dockerfile.api
environment: &api-environment # Add this anchor
DB_HOST: db
REDIS_HOST: redis
@ -18,6 +21,9 @@ services:
api-worker:
image: jhumanj/opnform-api:latest
build:
context: .
dockerfile: docker/Dockerfile.api
command: php artisan queue:work
environment:
<<: *api-environment
@ -29,6 +35,9 @@ services:
ui:
image: jhumanj/opnform-client:latest
build:
context: .
dockerfile: docker/Dockerfile.client
env_file:
- ./client/.env

View File

@ -67,7 +67,25 @@ We recommend using these official images for your OpnForm deployment.
## Building Your Own Docker Images
If you prefer to build your own Docker images, you can do so using the provided Dockerfiles in the repository:
By default, OpnForm uses pre-built images from Docker Hub. However, if you want to build the images yourself (for development or customization), you have two options:
### Option 1: Using Docker Compose (Recommended)
The simplest way to build the images is using Docker Compose:
```bash
docker compose build
```
This will build all the necessary images. You can then start the application as usual:
```bash
docker compose up -d
```
### Option 2: Building Images Manually
You can also build the images manually using the provided Dockerfiles:
1. Build the API image:
```bash
@ -79,6 +97,8 @@ If you prefer to build your own Docker images, you can do so using the provided
docker build -t opnform-ui:local -f docker/Dockerfile.client .
```
If you build the images manually, make sure to update your docker-compose.override.yml to use these local images (see below).
### Overriding Docker Compose Configuration
You can override the default Docker Compose configuration by creating a `docker-compose.override.yml` file. This allows you to customize various aspects of the deployment without modifying the main `docker-compose.yml` file.