From 62bde03bfddbdbd2b88eabbb137fa8b378bde621 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 9 Sep 2020 09:32:05 +0530 Subject: [PATCH 1/5] Hotfix for docker --- .dockerignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index ae61f74..31bb6fd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,4 +4,3 @@ Dockerfile docker-compose.yml LICENSE *.md -yotter-config.json From 4038a819f8b52ded9d97ce68a46930571ab10b18 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 9 Sep 2020 11:55:52 +0530 Subject: [PATCH 2/5] Some suggested changes. --- Dockerfile | 6 ++++-- docker-compose.yml | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index a09eafd..28f17e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:alpine +FROM python:3-alpine WORKDIR /usr/src/app @@ -6,9 +6,11 @@ RUN apk add gcc musl-dev libffi-dev openssl-dev libxml2-dev libxslt-dev file llv COPY requirements.txt ./ -RUN pip install wheel cryptography gunicorn pymysql +RUN pip install --no-cache-dir wheel cryptography gunicorn pymysql RUN pip install --no-cache-dir -r requirements.txt +RUN apk del gcc musl-dev libffi-dev openssl-dev libxml2-dev libxslt-dev file llvm-dev make g++ + COPY . . RUN flask db init \ diff --git a/docker-compose.yml b/docker-compose.yml index 44c391f..df7bac1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,13 +1,13 @@ -version: '3.4' +version: '3.8' services: mariadb: - image: mariadb:latest + image: mariadb:10.5 environment: MYSQL_ROOT_PASSWORD: changeme MYSQL_DATABASE: yotter MYSQL_USER: yotter MYSQL_PASSWORD: changeme - restart: on-failure + restart: unless-stopped volumes: - /var/lib/mysql healthcheck: From e3cfd22a6f549e07979f5c96eb61d918f0a7f8ee Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 9 Sep 2020 12:27:56 +0530 Subject: [PATCH 3/5] Add --no-cache --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 28f17e7..2d9e02f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM python:3-alpine WORKDIR /usr/src/app -RUN apk add gcc musl-dev libffi-dev openssl-dev libxml2-dev libxslt-dev file llvm-dev make g++ +RUN apk --no-cache add gcc musl-dev libffi-dev openssl-dev libxml2-dev libxslt-dev file llvm-dev make g++ COPY requirements.txt ./ From becd9df30d4eff11ab9de38a19ea8e3ee760155a Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 9 Sep 2020 12:40:34 +0530 Subject: [PATCH 4/5] Fix for lxml. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2d9e02f..6b36e67 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ COPY requirements.txt ./ RUN pip install --no-cache-dir wheel cryptography gunicorn pymysql RUN pip install --no-cache-dir -r requirements.txt -RUN apk del gcc musl-dev libffi-dev openssl-dev libxml2-dev libxslt-dev file llvm-dev make g++ +RUN apk del gcc musl-dev libffi-dev openssl-dev file llvm-dev make g++ COPY . . From 6abbd56df3f6f661999928def2fb61bd4fc6f786 Mon Sep 17 00:00:00 2001 From: FireMasterk <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 9 Sep 2020 14:31:33 +0530 Subject: [PATCH 5/5] Reduce docker image size. --- Dockerfile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6b36e67..5f8971d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,14 +2,12 @@ FROM python:3-alpine WORKDIR /usr/src/app -RUN apk --no-cache add gcc musl-dev libffi-dev openssl-dev libxml2-dev libxslt-dev file llvm-dev make g++ - COPY requirements.txt ./ -RUN pip install --no-cache-dir wheel cryptography gunicorn pymysql -RUN pip install --no-cache-dir -r requirements.txt - -RUN apk del gcc musl-dev libffi-dev openssl-dev file llvm-dev make g++ +RUN apk --no-cache add gcc musl-dev libffi-dev openssl-dev libxml2-dev libxslt-dev file llvm-dev make g++ \ + && pip install --no-cache-dir wheel cryptography gunicorn pymysql \ + && pip install --no-cache-dir -r requirements.txt \ + && apk del gcc musl-dev libffi-dev openssl-dev file llvm-dev make g++ COPY . .