SCGR commited on
Commit
1af8251
·
1 Parent(s): 427412f

generate thumbnails

Browse files
Files changed (2) hide show
  1. .github/workflows/ci.yml +0 -36
  2. Dockerfile +14 -1
.github/workflows/ci.yml CHANGED
@@ -145,39 +145,3 @@ jobs:
145
  run: |
146
  docker stop minio || true
147
  docker rm minio || true
148
-
149
- generate-production-thumbnails:
150
- runs-on: ubuntu-latest
151
- needs: build-and-test
152
- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
153
-
154
- steps:
155
- - name: Check out code
156
- uses: actions/checkout@v4
157
-
158
- - name: Setup Python
159
- uses: actions/setup-python@v4
160
- with:
161
- python-version: "3.11"
162
-
163
- - name: Install Python dependencies
164
- run: |
165
- cd py_backend
166
- python -m venv .venv
167
- source .venv/bin/activate
168
- pip install --upgrade pip
169
- pip install -r requirements.txt
170
-
171
- - name: Generate production thumbnails
172
- env:
173
- DATABASE_URL: ${{ secrets.DATABASE_URL }}
174
- S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
175
- S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
176
- S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
177
- S3_BUCKET: ${{ secrets.S3_BUCKET }}
178
- STORAGE_PROVIDER: s3
179
- run: |
180
- cd py_backend
181
- source .venv/bin/activate
182
- export PYTHONPATH="${PYTHONPATH}:$(pwd)"
183
- python generate_production_thumbnails.py
 
145
  run: |
146
  docker stop minio || true
147
  docker rm minio || true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Dockerfile CHANGED
@@ -36,6 +36,19 @@
36
  ENV PORT=7860
37
  EXPOSE 7860
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  # Start backend (serves API + static frontend)
40
- CMD uvicorn app.main:app --host 0.0.0.0 --port $PORT
41
 
 
36
  ENV PORT=7860
37
  EXPOSE 7860
38
 
39
+ # Create startup script
40
+ RUN echo '#!/bin/bash\n\
41
+ echo "Starting PromptAid Vision..."\n\
42
+ echo "Running database migrations..."\n\
43
+ alembic upgrade head\n\
44
+ echo "Database migrations completed"\n\
45
+ echo "Generating thumbnails for existing images..."\n\
46
+ python generate_production_thumbnails.py\n\
47
+ echo "Thumbnail generation completed"\n\
48
+ echo "Starting FastAPI server..."\n\
49
+ exec uvicorn app.main:app --host 0.0.0.0 --port $PORT\n\
50
+ ' > /app/start.sh && chmod +x /app/start.sh
51
+
52
  # Start backend (serves API + static frontend)
53
+ CMD ["/app/start.sh"]
54