forked from AOSSIE-Org/PictoPy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'AOSSIE-Org:main' into main
- Loading branch information
Showing
16 changed files
with
484 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,16 @@ Handles file system operations and provides a secure bridge between the frontend | |
|
||
#### Installation | ||
|
||
|
||
1. Clone the repository to your local system: | ||
```bash | ||
git clone [email protected]:AOSSIE-Org/PictoPy.git | ||
``` | ||
```bash | ||
cd PictoPy | ||
``` | ||
|
||
|
||
1. Navigate to the frontend directory: | ||
```bash | ||
cd frontend | ||
|
@@ -232,6 +242,9 @@ The server will start on `http://localhost:8000` by default. In test mode, the s | |
You can control the number of workers by setting the `WORKERS` environment variable before running the script. If not set, it defaults to 1 worker. | ||
### Docker Compose Setup | ||
- [Docker Compose](./docs/docker-compose/redme.md) | ||
### Setup using Dockerfile | ||
- For setting up the frontend, follow the instructions in the [Frontend Setup Guide](./docs/frontend/docker-setup.md). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: pictopy | ||
|
||
services: | ||
frontend: | ||
build: | ||
context: ./frontend | ||
dockerfile: Dockerfile | ||
container_name: frontend-container | ||
network_mode: host | ||
ports: | ||
- "1420:1420" | ||
environment: | ||
- DISPLAY=${DISPLAY} | ||
volumes: | ||
- /tmp/.X11-unix:/tmp/.X11-unix | ||
- images-data:/app/images | ||
- /:/host | ||
stdin_open: true | ||
tty: true | ||
|
||
backend: | ||
build: | ||
context: ./backend | ||
dockerfile: Dockerfile | ||
container_name: backend-container | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- images-data:/app/images | ||
- /:/host | ||
|
||
volumes: | ||
frontend-data: | ||
images-data: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,107 @@ | ||
# Backend Docker Setup for PictoPy | ||
|
||
This guide provides step-by-step instructions for building and running the PictoPy backend using Docker. | ||
|
||
## Table of Contents | ||
|
||
1. [Prerequisites](#prerequisites) | ||
2. [Building the Docker Image](#building-the-docker-image) | ||
3. [Running the Docker Container](#running-the-docker-container) | ||
4. [Verifying the Container](#verifying-the-container) | ||
5. [Accessing the Application](#accessing-the-application) | ||
6. [Stopping the Container](#stopping-the-container) | ||
7. [Troubleshooting](#troubleshooting) | ||
|
||
## Prerequisites | ||
|
||
Before you begin, ensure you have the Docker installed on your machine | ||
|
||
- Verify the installation by running: | ||
```bash | ||
docker --version | ||
``` | ||
|
||
## Building the Docker Image | ||
|
||
1. Open a terminal and navigate to your project's root directory. | ||
|
||
2. Go to Backend directory | ||
|
||
```bash | ||
cd backend | ||
``` | ||
|
||
3. Run the following command to build the Docker image, replacing `<image_name>` with your desired image name: | ||
|
||
```bash | ||
docker build -t <image_name> . | ||
``` | ||
|
||
4. Wait for the build process to complete. This may take a few minutes depending on your internet speed and system performance. | ||
|
||
## Running the Docker Container | ||
|
||
Once the image is built, you can run a container using the following command: | ||
|
||
```bash | ||
docker run -d -p 8000:8000 --name <container_name> <image_name> | ||
``` | ||
|
||
- `-d`: Runs the container in detached mode (in the background). | ||
- `-p 8000:8000`: Maps port 8000 on the host to port 8000 in the container. | ||
- `--name <container_name>`: Names the container for easier management. | ||
- `<image_name>`: Specifies the image to use (the one we just built). | ||
|
||
## Verifying the Container | ||
|
||
To check if the container is running: | ||
|
||
```bash | ||
docker ps | ||
``` | ||
|
||
You should see an entry for `<container_name>` with the status `Up`. | ||
|
||
## Accessing the Application | ||
|
||
Open a web browser or frontend to access the application at: | ||
|
||
``` | ||
http://localhost:8000 | ||
``` | ||
|
||
## Stopping the Container | ||
|
||
If you need to stop the container: | ||
|
||
```bash | ||
docker kill <container_id> | ||
``` | ||
|
||
## Troubleshooting | ||
|
||
1. **Port already in use**: If you get an error saying the port is already in use, you can either: | ||
|
||
- Stop the process using port 8000, or | ||
- Change the port mapping in the `docker run` command (e.g., `-p 8001:8000`) | ||
|
||
2. **Container exits immediately**: Check the container logs: | ||
|
||
```bash | ||
docker logs <container_name> | ||
``` | ||
|
||
3. **Permission issues**: Ensure that `run.sh` has execute permissions(for linux only): | ||
|
||
```bash | ||
chmod +x run.sh | ||
``` | ||
|
||
Then rebuild the Docker image. | ||
|
||
Remember to rebuild your Docker image (`docker build -t <image_name> .`) after making any changes to your application or Dockerfile. | ||
|
||
For more advanced Docker usage , view the [Docker documentation](https://docs.docker.com/get-started/). | ||
# Backend Docker Setup for PictoPy | ||
|
||
This guide provides step-by-step instructions for building and running the PictoPy backend using Docker. | ||
|
||
## Table of Contents | ||
|
||
1. [Prerequisites](#prerequisites) | ||
2. [Building the Docker Image](#building-the-docker-image) | ||
3. [Running the Docker Container](#running-the-docker-container) | ||
4. [Verifying the Container](#verifying-the-container) | ||
5. [Accessing the Application](#accessing-the-application) | ||
6. [Stopping the Container](#stopping-the-container) | ||
7. [Troubleshooting](#troubleshooting) | ||
|
||
## Prerequisites | ||
|
||
Before you begin, ensure you have the Docker installed on your machine | ||
|
||
- Verify the installation by running: | ||
```bash | ||
docker --version | ||
``` | ||
|
||
## Building the Docker Image | ||
|
||
1. Open a terminal and navigate to your project's root directory. | ||
|
||
2. Go to Backend directory | ||
|
||
```bash | ||
cd backend | ||
``` | ||
|
||
3. Run the following command to build the Docker image, replacing `<image_name>` with your desired image name: | ||
|
||
```bash | ||
docker build -t <image_name> . | ||
``` | ||
|
||
4. Wait for the build process to complete. This may take a few minutes depending on your internet speed and system performance. | ||
|
||
## Running the Docker Container | ||
|
||
Once the image is built, you can run a container using the following command: | ||
|
||
```bash | ||
docker run -it --name backend-container -p 8000:8000 \ | ||
-v images-data:/app/images \ | ||
-v /:/host \ | ||
<image-name> | ||
``` | ||
|
||
- `-it`: Runs the container interactively, attaching to the terminal for input/output. | ||
- `-p 8000:8000`: Maps port 8000 on the host to port 8000 in the container. | ||
- `-v`: Mounts a volume to share data between the host and container. | ||
- `<image_name>`: Specifies the image to use (the one we just built). | ||
|
||
## Verifying the Container | ||
|
||
To check if the container is running: | ||
|
||
```bash | ||
docker ps | ||
``` | ||
|
||
You should see an entry for `<container_name>` with the status `Up`. | ||
|
||
## Accessing the Application | ||
|
||
Open a web browser or frontend to access the application at: | ||
|
||
``` | ||
http://localhost:8000 | ||
``` | ||
|
||
## Stopping the Container | ||
|
||
If you need to stop the container: | ||
|
||
```bash | ||
docker kill <container_id> | ||
``` | ||
|
||
## Troubleshooting | ||
|
||
1. **Port already in use**: If you get an error saying the port is already in use, you can either: | ||
|
||
- Stop the process using port 8000, or | ||
- Change the port mapping in the `docker run` command (e.g., `-p 8001:8000`) | ||
|
||
2. **Container exits immediately**: Check the container logs: | ||
|
||
```bash | ||
docker logs <container_name> | ||
``` | ||
|
||
3. **Permission issues**: Ensure that `run.sh` has execute permissions(for linux only): | ||
|
||
```bash | ||
chmod +x run.sh | ||
``` | ||
|
||
Then rebuild the Docker image. | ||
|
||
Remember to rebuild your Docker image (`docker build -t <image_name> .`) after making any changes to your application or Dockerfile. | ||
|
||
For more advanced Docker usage , view the [Docker documentation](https://docs.docker.com/get-started/). |
Oops, something went wrong.