Merge branch 'main' of https://github.com/AJaySi/AI-Writer
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
# =====================================================================
|
||||
|
||||
# 1. Use official Python 3.11 image (builder stage)
|
||||
FROM python:3.11-slim AS builder
|
||||
FROM python:3.12
|
||||
|
||||
# 2. Set environment variables for Python
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
@@ -30,40 +30,46 @@ RUN apt-get update && \
|
||||
WORKDIR /app
|
||||
|
||||
# 5. Copy only requirements.txt first (for better caching)
|
||||
COPY ../../requirements.txt ./
|
||||
COPY ../requirements.txt ./
|
||||
|
||||
# 6. Install Python dependencies in builder
|
||||
RUN pip install --upgrade pip && \
|
||||
pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# 7. Clone the latest ALwrity code from GitHub (after dependencies for cache efficiency)
|
||||
RUN git clone https://github.com/AJaySi/AI-Writer.git .
|
||||
|
||||
# 8. Copy only necessary files to the final image (runtime stage)
|
||||
# === Start runtime stage ===
|
||||
FROM python:3.11-slim AS runtime
|
||||
|
||||
# 9. Set environment variables for Python
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
# 7. Copy app source code and requirements.txt to runtime image
|
||||
COPY ../requirements.txt ./
|
||||
COPY ../alwrity.py /app/
|
||||
COPY ../lib /app/lib
|
||||
|
||||
# 10. Create a non-root user for security
|
||||
# 8. Install Python dependencies in runtime as root
|
||||
RUN pip install --upgrade pip && \
|
||||
pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# 9. Create a non-root user for security
|
||||
RUN useradd -m alwrityuser
|
||||
USER alwrityuser
|
||||
|
||||
# 10. Set environment variable for Streamlit (optional: disables telemetry)
|
||||
ENV STREAMLIT_TELEMETRY=0
|
||||
|
||||
# 11. Set work directory
|
||||
WORKDIR /app
|
||||
|
||||
# 12. Copy installed packages and app from builder
|
||||
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
|
||||
COPY --from=builder /app /app
|
||||
# 12. Create logs directory and set permissions
|
||||
RUN mkdir -p /app/logs && chown -R alwrityuser:alwrityuser /app/logs
|
||||
|
||||
# 13. Expose Streamlit's default port
|
||||
EXPOSE 8501
|
||||
|
||||
# 14. Set environment variable for Streamlit (optional: disables telemetry)
|
||||
ENV STREAMLIT_TELEMETRY=0
|
||||
# 14. Switch to non-root user
|
||||
USER alwrityuser
|
||||
|
||||
# 15. Default command: run ALwrity with Streamlit
|
||||
# 15. Add user local bin to PATH
|
||||
ENV PATH="/home/alwrityuser/.local/bin:$PATH"
|
||||
|
||||
# 16. Default command: run ALwrity with Streamlit
|
||||
CMD ["streamlit", "run", "alwrity.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
||||
|
||||
# =====================================================================
|
||||
|
||||
@@ -17,18 +17,18 @@ Docker lets you run ALwrity in a safe, isolated environment on any computer (Win
|
||||
|
||||
### Step 2: Build the ALwrity Docker Image (No Manual Download Needed!)
|
||||
1. Open a terminal.
|
||||
2. Navigate to the `Getting Started` folder in your workspace:
|
||||
2. Navigate to the **root folder** of your workspace (where `requirements.txt` and `lib/` are located):
|
||||
```
|
||||
cd /workspaces/AI-Writer/Getting\ Started
|
||||
cd /workspaces/AI-Writer
|
||||
```
|
||||
3. Build the Docker image (this will automatically download the latest ALwrity code from GitHub):
|
||||
3. Build the Docker image:
|
||||
```
|
||||
docker build -t alwrity .
|
||||
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:
|
||||
1. Start the app with this command (from the root folder):
|
||||
```
|
||||
docker run -p 8501:8501 alwrity
|
||||
```
|
||||
@@ -50,6 +50,8 @@ Docker lets you run ALwrity in a safe, isolated environment on any computer (Win
|
||||
```
|
||||
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`:
|
||||
|
||||
@@ -28,7 +28,7 @@ logging.basicConfig(
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||
handlers=[
|
||||
logging.StreamHandler(),
|
||||
logging.FileHandler('website_analyzer.log')
|
||||
logging.FileHandler('logs/website_analyzer.log')
|
||||
]
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -320,4 +320,4 @@ class WebsiteAnalyzer:
|
||||
return response.text
|
||||
except Exception as e:
|
||||
logger.warning(f"Error fetching sitemap.xml: {str(e)}")
|
||||
return None
|
||||
return None
|
||||
@@ -15,6 +15,7 @@ exa_py>=1.9.1
|
||||
GoogleNews>=1.6.15
|
||||
langchain-google-genai>=2.0.10
|
||||
clint>=0.5.1
|
||||
emoji==2.14.1
|
||||
textblob==0.19.0
|
||||
numpy>=1.22.4,<2.0.0
|
||||
pandas>=2.0.3
|
||||
|
||||
Reference in New Issue
Block a user