opnform-host-nginx/docs/deployment/docker.mdx

130 lines
3.4 KiB
Plaintext
Raw Normal View History

---
Developer docker setup (#683) * 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 * Add development Docker configuration Introduce development-specific Docker configuration: - Create docker-compose.dev.yml for local development setup - Add nginx.dev.conf with development CORS settings - Update Dockerfile.api to support environment-specific dependency installation - Configure development services with appropriate volumes and environment variables * Improve Docker and Development Documentation - Remove platform-specific ARM64 constraints in docker-compose.dev.yml - Enhance Nginx configuration with improved proxy and HMR settings - Update documentation for development setup and Docker deployment - Add new Docker development documentation page - Refactor getting started guide with clearer development instructions * Enhance Docker configuration and CI/CD pipeline - Update Docker Compose files with improved service configurations - Add database healthcheck in docker-compose.yml - Refactor GitHub Actions workflow for Docker image publishing - Optimize Dockerfile.api with multi-stage build and environment-specific configurations - Update Nginx configuration for development and production environments * Add GitHub Actions permissions for Docker image publishing Configure GitHub Actions workflow with explicit read and write permissions for content and packages to improve security and clarity of Docker image deployment process --------- Signed-off-by: Daniel Ekman <knegge@gmail.com> Co-authored-by: Daniel Ekman <knegge@gmail.com>
2025-01-28 17:52:48 +01:00
title: "Docker Deployment"
description: "Deploy OpnForm using Docker"
---
import CloudVersion from "/snippets/cloud-version.mdx";
<CloudVersion/>
Developer docker setup (#683) * 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 * Add development Docker configuration Introduce development-specific Docker configuration: - Create docker-compose.dev.yml for local development setup - Add nginx.dev.conf with development CORS settings - Update Dockerfile.api to support environment-specific dependency installation - Configure development services with appropriate volumes and environment variables * Improve Docker and Development Documentation - Remove platform-specific ARM64 constraints in docker-compose.dev.yml - Enhance Nginx configuration with improved proxy and HMR settings - Update documentation for development setup and Docker deployment - Add new Docker development documentation page - Refactor getting started guide with clearer development instructions * Enhance Docker configuration and CI/CD pipeline - Update Docker Compose files with improved service configurations - Add database healthcheck in docker-compose.yml - Refactor GitHub Actions workflow for Docker image publishing - Optimize Dockerfile.api with multi-stage build and environment-specific configurations - Update Nginx configuration for development and production environments * Add GitHub Actions permissions for Docker image publishing Configure GitHub Actions workflow with explicit read and write permissions for content and packages to improve security and clarity of Docker image deployment process --------- Signed-off-by: Daniel Ekman <knegge@gmail.com> Co-authored-by: Daniel Ekman <knegge@gmail.com>
2025-01-28 17:52:48 +01:00
<Tip>
This guide is for deploying OpnForm on a production server. If you're looking to **develop OpnForm locally**, check out our [Docker Development Setup](/deployment/docker-development) guide which provides **hot-reload and other development features**.
</Tip>
## Prerequisites
- Docker
- Docker Compose
## Quick Start
1. Clone the repository:
```bash
git clone https://github.com/JhumanJ/OpnForm.git
cd OpnForm
```
2. Set up environment files:
```bash
./scripts/setup-env.sh --docker
```
3. (Optional) Customize the environment variables:
You can modify two environment files to customize your OpnForm installation:
- The `.env` file in the `api` directory for backend configuration
- The `.env` file in the `client` directory for frontend configuration
For more information on available environment variables, please refer to our [Environment Variables](/configuration/environment-variables) page.
4. Start the application:
```bash
docker compose up -d
```
5. Access OpnForm at http://localhost
2024-09-04 12:33:46 +02:00
### Initial Login
After installation, use these credentials to access the app:
- Email: `admin@opnform.com`
- Password: `password`
You will be prompted to change your email and password after your first login.
<Note>Public registration is disabled in the self-hosted version. Use the admin account to invite additional users.</Note>
## Docker Images
OpnForm provides pre-built Docker images for easy deployment. You can find our official Docker images on Docker Hub:
- [OpnForm API Image](https://hub.docker.com/r/jhumanj/opnform-api)
- [OpnForm Client Image](https://hub.docker.com/r/jhumanj/opnform-client)
We recommend using these official images for your OpnForm deployment.
## Building Your Own Docker Images
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
docker build -t opnform-api:local -f docker/Dockerfile.api .
```
2. Build the UI image:
```bash
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.
Example `docker-compose.override.yml`:
```yaml
services:
api:
image: opnform-api:local
ui:
image: opnform-ui:local
api-worker:
image: opnform-api:local
```
### Clearing all resources
To completely remove all Docker containers, networks, and volumes created by Docker Compose and also remove all images used by these services, you can use the following command:
```
docker compose down -v --rmi all
```