Content Calendar, Content Gap Analysis, and Content Optimization
This commit is contained in:
83
Getting Started/Option_3_Docker_Install/Dockerfile
Normal file
83
Getting Started/Option_3_Docker_Install/Dockerfile
Normal file
@@ -0,0 +1,83 @@
|
||||
# =====================================================================
|
||||
# ALwrity Automated Dockerfile - Best Practices & Full Functionality
|
||||
# =====================================================================
|
||||
# This Dockerfile is designed for cache efficiency, security, and ease of use.
|
||||
# It uses multi-stage builds for smaller images and leverages Docker layer caching.
|
||||
# =====================================================================
|
||||
|
||||
# 1. Use official Python 3.12 image (builder stage)
|
||||
FROM python:3.12
|
||||
|
||||
# 2. Set environment variables for Python
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
# 3. Install build dependencies first (for cache efficiency)
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
gcc \
|
||||
git \
|
||||
curl \
|
||||
wget \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
rustc \
|
||||
cargo \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 4. Set work directory
|
||||
WORKDIR /app
|
||||
|
||||
# 5. Copy only requirements.txt first (for better caching)
|
||||
COPY ../requirements.txt ./
|
||||
|
||||
# 6. Install Python dependencies in builder
|
||||
RUN pip install --upgrade pip && \
|
||||
pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# === Start runtime stage ===
|
||||
FROM python:3.11-slim AS runtime
|
||||
|
||||
# 7. Install build tools needed for wordcloud
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends gcc build-essential && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 8. Set work directory
|
||||
WORKDIR /app
|
||||
|
||||
# 9. Copy app source code, requirements, and .env to runtime image
|
||||
COPY ../requirements.txt ./
|
||||
COPY ../alwrity.py /app/
|
||||
COPY ../lib /app/lib
|
||||
|
||||
# Create the .env file with default values
|
||||
RUN echo "# Default environment variables for ALwrity\n" > /app/.env
|
||||
|
||||
# 10. Install Python dependencies
|
||||
RUN pip install --upgrade pip && \
|
||||
pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# 11. Create a non-root user for security
|
||||
RUN useradd -m alwrityuser
|
||||
|
||||
# 12. Change ownership of /app and .env to the non-root user
|
||||
RUN chown -R alwrityuser:alwrityuser /app
|
||||
|
||||
# 13. Set environment variable for Streamlit (optional: disables telemetry)
|
||||
ENV STREAMLIT_TELEMETRY=0
|
||||
|
||||
# 14. Expose Streamlit's default port
|
||||
EXPOSE 8501
|
||||
|
||||
# 15. Switch to non-root user
|
||||
USER alwrityuser
|
||||
|
||||
# 16. Add user local bin to PATH
|
||||
ENV PATH="/home/alwrityuser/.local/bin:$PATH"
|
||||
|
||||
# 17. Default command: run ALwrity with Streamlit
|
||||
CMD ["streamlit", "run", "alwrity.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
||||
|
||||
# =====================================================================
|
||||
# END OF DOCKERFILE
|
||||
# =====================================================================
|
||||
70
Getting Started/Option_3_Docker_Install/README.md
Normal file
70
Getting Started/Option_3_Docker_Install/README.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
|
||||
## Using ALwrity with Docker (Recommended for All Users)
|
||||
|
||||
### What is Docker?
|
||||
Docker lets you run ALwrity in a safe, isolated environment on any computer (Windows, Mac, Linux) without worrying about Python or system setup. Think of it as a "ready-to-go" box for the app.
|
||||
|
||||
### Step 1: Install Docker
|
||||
- Go to [https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/)
|
||||
- Download and install Docker Desktop for your operating system (Windows/Mac) or follow the Linux instructions.
|
||||
- After installation, restart your computer if prompted.
|
||||
- To check Docker is working, open a terminal and run:
|
||||
```
|
||||
docker --version
|
||||
```
|
||||
You should see a version number.
|
||||
|
||||
### Step 2: Build the ALwrity Docker Image (No Manual Download Needed!)
|
||||
1. Open a terminal.
|
||||
2. Navigate to the **root folder** of your workspace (where `requirements.txt` and `lib/` are located):
|
||||
```
|
||||
cd /workspaces/AI-Writer
|
||||
```
|
||||
3. Build the Docker image:
|
||||
```
|
||||
docker build -t alwrity -f "Getting Started/Dockerfile" .
|
||||
```
|
||||
> **Note:** You do NOT need to manually download or clone the project. The Dockerfile will do this for you!
|
||||
|
||||
### Step 3: Run ALwrity in Docker
|
||||
1. Start the app with this command (from the root folder):
|
||||
```
|
||||
docker run -p 8501:8501 alwrity
|
||||
```
|
||||
2. Wait until you see a message like:
|
||||
```
|
||||
Local URL: http://localhost:8501
|
||||
```
|
||||
3. Open your web browser and go to [http://localhost:8501](http://localhost:8501)
|
||||
4. Follow the on-screen instructions to set up your API keys and start creating content!
|
||||
|
||||
### Stopping ALwrity
|
||||
- To stop the app, go back to the terminal and press `Ctrl+C`.
|
||||
|
||||
### Advanced: Saving Your Work
|
||||
- By default, any files you create inside Docker are lost when the container stops.
|
||||
- To save your work to your computer, run:
|
||||
```
|
||||
docker run -p 8501:8501 -v $(pwd)/alwrity_data:/app/your_data_folder alwrity
|
||||
```
|
||||
Replace `your_data_folder` with the folder ALwrity uses for output (see documentation).
|
||||
|
||||
ALwrity UI will guide the first time about required API keys and how to & where to get them. We have selected most of API which are free Or provide generous free API per month. For more details read this blog: https://www.alwrity.com/post/personalization-for-alwrity-ai-content-writer
|
||||
|
||||
### Troubleshooting
|
||||
- If you see errors about missing ports or permissions, make sure Docker Desktop is running.
|
||||
- If you get a 'permission denied' error on Linux, try running with `sudo`:
|
||||
```
|
||||
sudo docker run -p 8501:8501 alwrity
|
||||
```
|
||||
- For other issues, check the Troubleshooting section below or open an issue on GitHub.
|
||||
|
||||
---
|
||||
|
||||
## Need More Help?
|
||||
- Visit the [official Docker documentation](https://docs.docker.com/get-started/)
|
||||
- Open an issue on our GitHub page
|
||||
- Join our support community
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user