Spaces:
Running
Running
Commit
·
1f33b89
1
Parent(s):
6692ef0
Update Dockerfile: create and populate models directory with new database models, enhancing application structure and organization.
Browse files- Dockerfile +3 -2
Dockerfile
CHANGED
@@ -33,9 +33,10 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
33 |
# Copy the entire application code
|
34 |
COPY --chown=app:app . .
|
35 |
|
36 |
-
#
|
37 |
RUN mkdir -p /app/app/models && \
|
38 |
-
|
|
|
39 |
chown -R app:app /app/app/models
|
40 |
|
41 |
# Make scripts executable
|
|
|
33 |
# Copy the entire application code
|
34 |
COPY --chown=app:app . .
|
35 |
|
36 |
+
# Create and populate the models directory
|
37 |
RUN mkdir -p /app/app/models && \
|
38 |
+
echo '"""Database models and configuration."""\nfrom sqlalchemy.ext.declarative import declarative_base\nBase = declarative_base()' > /app/app/models/__init__.py && \
|
39 |
+
echo '"""Database models."""\nfrom datetime import datetime\nfrom sqlalchemy import Column, Integer, String, DateTime, Float, Text, JSON, Boolean\nfrom sqlalchemy.ext.declarative import declarative_base\n\nBase = declarative_base()\n\nclass Audiobook(Base):\n """Model for storing audiobook information."""\n __tablename__ = "audiobooks"\n\n id = Column(String(36), primary_key=True)\n title = Column(String(255), nullable=False)\n author = Column(String(255))\n voice_id = Column(String(50), nullable=False)\n status = Column(String(20), nullable=False, default="pending")\n created_at = Column(DateTime, nullable=False, default=datetime.utcnow)\n updated_at = Column(DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)\n duration = Column(Float)\n file_path = Column(String(255))\n error = Column(Text)\n metadata = Column(JSON)\n\nclass Voice(Base):\n """Model for storing voice information."""\n __tablename__ = "voices"\n\n id = Column(String(36), primary_key=True)\n name = Column(String(255), nullable=False)\n type = Column(String(50), nullable=False)\n speaker_id = Column(Integer)\n created_at = Column(DateTime, nullable=False, default=datetime.utcnow)\n is_active = Column(Boolean, default=True)\n metadata = Column(JSON)\n\nclass AudioCache(Base):\n """Model for caching generated audio."""\n __tablename__ = "audio_cache"\n\n id = Column(String(36), primary_key=True)\n hash = Column(String(64), nullable=False, unique=True)\n format = Column(String(10), nullable=False)\n created_at = Column(DateTime, nullable=False, default=datetime.utcnow)\n file_path = Column(String(255), nullable=False)\n metadata = Column(JSON)' > /app/app/models/database.py && \
|
40 |
chown -R app:app /app/app/models
|
41 |
|
42 |
# Make scripts executable
|