Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Use the official lightweight Python image.
# https://hub.docker.com/_/python
FROM python:3.7-slim
# FROM python:3.7-slim
FROM tensorflow/tensorflow:2.1.0-gpu-py3

# Copy local code to the container image.
ENV APP_HOME /app
Expand All @@ -9,17 +10,18 @@ COPY . ./

ENV GOOGLE_APPLICATION_CREDENTIALS "./token.json"

RUN apt-get update && apt-get install -y \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
ffmpeg
RUN apt-get update && apt-get install -y ffmpeg python3-opencv
# RUN apt-get update && apt-get install -y \
# libglib2.0-0 \
# libsm6 \
# libxext6 \
# libxrender-dev \
# ffmpeg
# Install production dependencies.
RUN pip install -r requirements.txt

# Run the web service on container startup. Here we use the gunicorn
# webserver, with one worker process and 8 threads.
# For environments with multiple CPU cores, increase the number of workers
# to be equal to the cores available.
CMD exec gunicorn --bind 0.0.0.0:8080 --workers 1 --threads 8 --timeout 0 app:app
# CMD exec gunicorn --bind 0.0.0.0:8080 --workers 1 --threads 8 --timeout 0 app:app
22 changes: 22 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "3.9"
services:
Cartoonizer:
build:
context: .
dockerfile: CartoonizerDockerfile
image: cartoonize
# if you need bind mount
# volumes:
# - ".:/app"
ports:
- 8080:8080

deploy:
resources:
reservations:
devices:
- driver: nvidia
capabilities: [gpu]
device_ids: ["0"]

entrypoint: ["python", "app.py"]