Create a Dockerfile in your project directory. This file will define how your Docker image is built. Here’s a basic example:
Dockerfile
# Use an official Python runtime as a parent image
FROM frappe/erpnext-worker:edge
# Set the working directory in the container
WORKDIR /home/frappe/frappe-bench
# Copy your custom app(s) into the container
COPY ./custom_apps/* /home/frappe/frappe-bench/apps/
# Install any additional dependencies if needed
# For example, if you have custom requirements for your app
# RUN pip install -r requirements.txt
# Set permissions (adjust as necessary)
RUN chown -R frappe:frappe /home/frappe/frappe-bench/apps/*
# Expose ports (if necessary)
# EXPOSE 80
# Start the services
CMD ["bench", "start"]
2. Directory Structure
Make sure your project directory structure looks something like this:
project-directory/
│
├── Dockerfile
├── custom_apps/
│ ├── frappe/
│ ├── erpnext/
│ ├── hrms/
│ └── your_custom_app/ # Include your customizations here
│ ├── hooks.py
│ ├── patches.txt
│ └── ...
│
└── ...
3. Build the Docker Image
Navigate to your project directory in the terminal and build your Docker image using the docker build command:
docker build -t my-custom-erpnext .
Replace my-custom-erpnext with a suitable name for your Docker image.
4. Run the Docker Container
Once the image is built, you can run a container based on that image:
docker run -d -p 8000:8000 my-custom-erpnext
This command runs a container in detached mode (-d) and maps port 8000 of your container to port 8000 of your host system (-p 8000:8000).