@@ -92,7 +92,34 @@ RUN echo "Verifying logs API routes in build output..." && \
9292 else \
9393 echo "β
Found: logs-statistics.get.mjs"; \
9494 fi && \
95- echo "β
All logs API routes verified successfully"
95+ echo "β
All logs API routes verified successfully" && \
96+ echo "" && \
97+ echo "Verifying collections API routes..." && \
98+ if [ ! -f ".output/server/chunks/routes/api/collections.get.mjs" ]; then \
99+ echo "β Missing route: collections.get.mjs"; \
100+ exit 1; \
101+ else \
102+ echo "β
Found: collections.get.mjs"; \
103+ fi && \
104+ if [ ! -d ".output/server/chunks/routes/api/collections" ]; then \
105+ echo "β ERROR: collections/ directory not found in build output!"; \
106+ exit 1; \
107+ else \
108+ echo "β
Found: collections/ directory"; \
109+ fi && \
110+ if [ ! -f ".output/server/chunks/routes/api/seerr-collections.get.mjs" ]; then \
111+ echo "β Missing route: seerr-collections.get.mjs"; \
112+ exit 1; \
113+ else \
114+ echo "β
Found: seerr-collections.get.mjs"; \
115+ fi && \
116+ if [ ! -d ".output/server/chunks/routes/api/seerr-collections" ]; then \
117+ echo "β ERROR: seerr-collections/ directory not found in build output!"; \
118+ exit 1; \
119+ else \
120+ echo "β
Found: seerr-collections/ directory"; \
121+ fi && \
122+ echo "β
All collections API routes verified successfully"
96123
97124# ==============================================================================
98125# Stage 3: Final Unified Image
@@ -177,31 +204,52 @@ COPY --from=node-builder /app/frontend/node_modules /app/node_modules
177204
178205WORKDIR /app
179206
180- # Copy application code
181- COPY . .
182-
183- # Copy MySQL initialization scripts
184- COPY mysql-init /docker-entrypoint-initdb.d/
185-
186- # Create necessary directories
187- RUN mkdir -p /app/logs /app/data /var/lib/mysql /var/run/mysqld && \
207+ # Create necessary directories first
208+ RUN mkdir -p /app/logs /app/data /app/data-default /var/lib/mysql /var/run/mysqld && \
188209 chown -R mysql:mysql /var/lib/mysql /var/run/mysqld && \
189210 chmod 755 /var/lib/mysql /var/run/mysqld
190211
191- # Explicitly copy essential data files and images if they exist in build context
212+ # Explicitly copy essential data files (JSON only - images are now fetched from TMDB)
213+ # Copy data directory BEFORE copying the rest of the application to ensure files are in build context
192214# These files should be committed to git (use Git LFS if too large)
193- RUN if [ -d "data" ]; then \
194- mkdir -p /app/data /app/data-default /app/data/images /app/data-default/images && \
195- cp -r data/*.json /app/data/ 2>/dev/null || true && \
196- cp -r /app/data/*.json /app/data-default/ 2>/dev/null || true && \
197- if [ -d "data/images" ]; then \
198- cp -r data/images/* /app/data/images/ 2>/dev/null || true && \
199- cp -r /app/data/images/* /app/data-default/images/ 2>/dev/null || true; \
200- fi && \
201- chmod -R 755 /app/data /app/data-default; \
202- else \
203- echo "Warning: data/ directory not found in build context. Essential files should be in git."; \
204- fi
215+ # Note: This will fail if data/ directory doesn't exist, which is desired behavior
216+ COPY data/ /tmp/data/
217+
218+ # Verify and copy critical data files (fail build if missing)
219+ RUN echo "Verifying essential data files..." && \
220+ if [ ! -d "/tmp/data" ]; then \
221+ echo "β ERROR: data/ directory not found in build context"; \
222+ echo " Ensure data/ directory exists and contains required JSON files"; \
223+ exit 1; \
224+ fi && \
225+ MISSING=0 && \
226+ for file in seerr-collections.json unified.json franchises.json regex-presets.json; do \
227+ if [ -f "/tmp/data/$file" ]; then \
228+ cp "/tmp/data/$file" "/app/data/$file" && \
229+ echo "β
Found: $file ($(du -h /app/data/$file | cut -f1))"; \
230+ else \
231+ echo "β ERROR: Missing critical data file: $file"; \
232+ MISSING=1; \
233+ fi; \
234+ done && \
235+ if [ "$MISSING" -eq 1 ]; then \
236+ echo "β Build failed: Critical data files are missing from build context."; \
237+ echo " Ensure data/*.json files are committed to git and not excluded by .dockerignore"; \
238+ exit 1; \
239+ fi && \
240+ # Copy all other JSON files from data directory if they exist
241+ cp /tmp/data/*.json /app/data/ 2>/dev/null || true && \
242+ # Copy to data-default as backup
243+ cp -r /app/data/*.json /app/data-default/ 2>/dev/null || true && \
244+ chmod -R 755 /app/data /app/data-default && \
245+ rm -rf /tmp/data && \
246+ echo "β
All essential data files verified successfully"
247+
248+ # Copy application code (after data files are verified)
249+ COPY . .
250+
251+ # Copy MySQL initialization scripts
252+ COPY mysql-init /docker-entrypoint-initdb.d/
205253
206254# Copy supervisor configuration
207255COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
0 commit comments