Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main #47

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Main #47

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
6 changes: 5 additions & 1 deletion project-ml-microservice-kubernetes/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ FROM python:3.7.3-stretch

## Step 1:
# Create a working directory
WORKDIR /app

## Step 2:
# Copy source code to working directory
COPY . /app

## Step 3:
# Install packages from requirements.txt
RUN pip install --no-cache-dir --trusted-host pypi.python.org -r requirements.txt
# hadolint ignore=DL3013

## Step 4:
# Expose port 80
EXPOSE 80

## Step 5:
# Run app.py at container launch

CMD ["python", "app.py"]
5 changes: 5 additions & 0 deletions project-ml-microservice-kubernetes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ setup:
python3 -m venv ~/.devops

install:
# Some necessary files for Scipy to work for Ubuntu
# sudo apt install libblas3 liblapack3 liblapack-dev libblas-dev -y
# sudo apt install gfortran -y
# This should be run from inside a virtualenv
pip install --upgrade pip &&\
pip install -r requirements.txt
Expand All @@ -22,6 +25,8 @@ test:

lint:
# See local hadolint install instructions: https://github.com/hadolint/hadolint
wget -O /bin/hadolint https://github.com/hadolint/hadolint/releases/download/v2.10.0/hadolint-Linux-x86_64
chmod +x /bin/hadolint
# This is linter for Dockerfiles
hadolint Dockerfile
# This is a linter for Python source code linter: https://www.pylint.org/
Expand Down
6 changes: 5 additions & 1 deletion project-ml-microservice-kubernetes/run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@

# Step 1:
# Build image and add a descriptive tag
docker build --tag=ml-kub-project .

# Step 2:
# List docker images
docker image ls

# Step 3:
# Run flask app
# Run flask app with logging local and to a file
docker run -p 8000:80 ml-kub-project
# docker run --log-driver local --log-opt max-size=10m --log-opt max-file=3 -p 8000:80 ml-kub-project