Skip to content

imvickykumar999/Flask-CRUD-Admin

Repository files navigation

Flask CRUD Admin

docker pull imvickykumar999/flask-admin:latest
docker run -p 5000:5000 imvickykumar999/flask-admin:latest

image

Pull Docker Image: (to run without building)

docker pull ghcr.io/imvickykumar999/flask-cms-gunicorn:latest
docker run -p 5000:5000 ghcr.io/imvickykumar999/flask-cms-gunicorn:latest

To run locally using Docker:

docker-compose up --build
  • This will build the image (if needed) and start the Flask app at http://localhost:5000.

  • To stop the app, press Ctrl+C or run:

    docker-compose down

image image image image image image image


🐳 Step-by-Step: Run Your Flask Blog with Docker


✅ 1. Create a Dockerfile in your project root

# Use official Python image
FROM python:3.10-slim

# Set working directory inside container
WORKDIR /app

# Copy your project files
COPY . /app

# Install dependencies
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

# Expose the port Flask runs on
EXPOSE 5000

# Run your app
CMD ["python", "app.py"]

✅ 2. Create requirements.txt (if not already)

Generate it with:

pip freeze > requirements.txt

✅ This should include things like:

Flask
Flask-Admin
Flask-Login
Flask-SQLAlchemy
Flask-CKEditor
Flask-Babel

✅ 3. Create .dockerignore (optional but recommended)

venv/
__pycache__/
*.pyc
*.db
.env

✅ 4. Build Your Docker Image

From the root of your project (where Dockerfile lives):

docker build -t flask-cms .

✅ 5. Run the Container

docker run -d -p 5000:5000 flask-cms

Then open your browser:

📍 http://localhost:5000


🧠 Bonus: Use Docker Volume for SQLite DB Persistence

To save your cms.db outside the container:

docker run -d -p 5000:5000 \
    -v $(pwd)/cms.db:/app/cms.db \
    flask-cms

🧠 Optional: Use docker-compose

If you want to add a database like PostgreSQL later, use docker-compose.yml. I can provide that too.


✅ Summary

Task Command
Build image docker build -t flask-cms .
Run app docker run -p 5000:5000 flask-cms
View app http://localhost:5000