Skip to content

Commit

Permalink
feat: add Docker support with Dockerfile and compose.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
dk-a-dev committed Jan 26, 2025
1 parent c2dac57 commit 5ff4773
Show file tree
Hide file tree
Showing 6 changed files with 682 additions and 356 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,8 @@ dist

# SvelteKit build / generate output
.svelte-kit
venv
test.py
panda.csv
./package-lock.json

# End of https://www.toptal.com/developers/gitignore/api/macos,node,git
3 changes: 3 additions & 0 deletions art-gallery/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
npm-debug.log
.env
36 changes: 36 additions & 0 deletions art-gallery/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Use platform-specific base image
FROM --platform=linux/arm64 node:18

# Set working directory
WORKDIR /usr/src/app

# Copy package files
COPY package*.json ./

# Install Sharp specifically for ARM64
RUN npm install --platform=linux --arch=arm64 sharp
RUN npm install
RUN npm ci && \
npm rebuild @tensorflow/tfjs-node --build-from-source

# System dependencies
RUN apt-get update && \
apt-get install -y curl tar && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Download model
RUN mkdir -p /app/arbitrary-image-stylization-v1-tensorflow1-256-v2 && \
curl -L -o /app/arbitrary-image-stylization-v1-tensorflow1-256-v2.tar.gz \
https://www.kaggle.com/api/v1/models/google/arbitrary-image-stylization-v1/tensorFlow1/256/2/download && \
tar -xvzf /app/arbitrary-image-stylization-v1-tensorflow1-256-v2.tar.gz -C /app/arbitrary-image-stylization-v1-tensorflow1-256-v2 && \
rm /app/arbitrary-image-stylization-v1-tensorflow1-256-v2.tar.gz

# Copy the rest of the application files into the container
COPY . .

# Expose the port the app runs on
EXPOSE 3000

# Specify the command to run your application
CMD ["node", "app.js"]
12 changes: 12 additions & 0 deletions art-gallery/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.8'
services:
app:
build:
context: .
volumes:
- ./public/uploads:/app/public/uploads
- ./public/placeholders:/app/public/placeholders
ports:
- "8000:8000"
env_file:
- .env
Loading

0 comments on commit 5ff4773

Please sign in to comment.