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
|
build
|
||||||
images/
|
images/
|
||||||
*.html
|
*.html
|
||||||
*.png
|
|
||||||
*.jpg
|
*.jpg
|
||||||
*.jpeg
|
*.jpeg
|
||||||
*.gif
|
*.gif
|
||||||
|
|||||||
@ -5,5 +5,6 @@ COPY package.json package-lock.json ./
|
|||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN chmod +x start.sh
|
||||||
|
|
||||||
CMD ["sh", "-c", "node fetchImages.js && node generateSite.js"]
|
CMD ["./start.sh"]
|
||||||
|
|||||||
@ -4,8 +4,8 @@ services:
|
|||||||
gallery:
|
gallery:
|
||||||
build: .
|
build: .
|
||||||
volumes:
|
volumes:
|
||||||
- ./public:/app/public
|
|
||||||
- ./images:/app/images
|
- ./images:/app/images
|
||||||
|
- ./images.json:/app/images.json
|
||||||
expose:
|
expose:
|
||||||
- "3000"
|
- "3000"
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@ -62,20 +62,22 @@ async function getAlbumAssets() {
|
|||||||
const fileName = `${asset.id}_${asset.originalFileName || 'untitled'}`;
|
const fileName = `${asset.id}_${asset.originalFileName || 'untitled'}`;
|
||||||
const outputPath = path.join(config.outputDir, fileName);
|
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
|
// Check if file already exists and is in our metadata
|
||||||
const existingImage = existingImages.find(img => img.id === asset.id);
|
const existingImage = existingImages.find(img => img.id === asset.id);
|
||||||
if (existingImage) {
|
if (existingImage) {
|
||||||
console.log(`- Found in metadata: ${existingImage.localPath}`);
|
// Normalize the paths to ensure consistent comparison
|
||||||
if (fs.existsSync(existingImage.localPath)) {
|
const normalizedExistingPath = path.normalize(existingImage.localPath);
|
||||||
console.log(`- File exists on disk, skipping download`);
|
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);
|
images.push(existingImage);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
console.log(`- File not found on disk at ${existingImage.localPath}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Downloading: ${fileName}`);
|
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