Refactor Dockerfile to execute start.sh and update .gitignore to exclude *.png files. Enhance fetchImages.js with improved path normalization and debug logging for asset checks, ensuring more reliable image fetching and processing.
This commit is contained in:
parent
09a34e2f38
commit
ba39cb4af7
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,7 +3,6 @@ dist
|
||||
build
|
||||
images/
|
||||
*.html
|
||||
*.png
|
||||
*.jpg
|
||||
*.jpeg
|
||||
*.gif
|
||||
|
||||
@ -5,5 +5,6 @@ COPY package.json package-lock.json ./
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
RUN chmod +x start.sh
|
||||
|
||||
CMD ["sh", "-c", "node fetchImages.js && node generateSite.js"]
|
||||
CMD ["./start.sh"]
|
||||
|
||||
@ -4,8 +4,8 @@ services:
|
||||
gallery:
|
||||
build: .
|
||||
volumes:
|
||||
- ./public:/app/public
|
||||
- ./images:/app/images
|
||||
- ./images.json:/app/images.json
|
||||
expose:
|
||||
- "3000"
|
||||
environment:
|
||||
|
||||
@ -62,20 +62,22 @@ async function getAlbumAssets() {
|
||||
const fileName = `${asset.id}_${asset.originalFileName || 'untitled'}`;
|
||||
const outputPath = path.join(config.outputDir, fileName);
|
||||
|
||||
// Add debug logging to understand the state
|
||||
console.log(`Checking asset ${asset.id}:`);
|
||||
console.log(`- Expected path: ${outputPath}`);
|
||||
|
||||
// Check if file already exists and is in our metadata
|
||||
const existingImage = existingImages.find(img => img.id === asset.id);
|
||||
if (existingImage) {
|
||||
console.log(`- Found in metadata: ${existingImage.localPath}`);
|
||||
if (fs.existsSync(existingImage.localPath)) {
|
||||
console.log(`- File exists on disk, skipping download`);
|
||||
// Normalize the paths to ensure consistent comparison
|
||||
const normalizedExistingPath = path.normalize(existingImage.localPath);
|
||||
const normalizedOutputPath = path.normalize(outputPath);
|
||||
|
||||
console.log(`Checking paths:`);
|
||||
console.log(`- Current path: ${normalizedOutputPath}`);
|
||||
console.log(`- Existing path: ${normalizedExistingPath}`);
|
||||
|
||||
if (fs.existsSync(normalizedOutputPath)) {
|
||||
console.log(`File exists, skipping: ${fileName}`);
|
||||
images.push(existingImage);
|
||||
continue;
|
||||
}
|
||||
console.log(`- File not found on disk at ${existingImage.localPath}`);
|
||||
}
|
||||
|
||||
console.log(`Downloading: ${fileName}`);
|
||||
|
||||
BIN
public/AnalogCamera.png
Normal file
BIN
public/AnalogCamera.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 909 B |
BIN
public/AnalogCameraS.png
Normal file
BIN
public/AnalogCameraS.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 969 B |
BIN
public/favicon.png
Normal file
BIN
public/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 969 B |
Loading…
x
Reference in New Issue
Block a user