From 5d583017564e3ca5fb2f2be5ffe4a4597571155b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <git@imaniti.org>
Date: Mon, 3 Apr 2023 16:41:54 +0200
Subject: [PATCH] improve + fix dockerfile

---
 Dockerfile | 26 +++++++++++++++++++-------
 VERSION    |  2 +-
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index cac56bcc..23b80cb4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,12 +1,13 @@
-FROM python:3.10
+FROM python:3.10 as base
 
-RUN mkdir /app
-WORKDIR /app
+# Setup env
+ENV LANG C.UTF-8
+ENV LC_ALL C.UTF-8
+ENV PYTHONDONTWRITEBYTECODE 1
+ENV PYTHONFAULTHANDLER 1
+ENV DEBIAN_FRONTEND noninteractive
 
-RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash -
-RUN apt-get install nodejs && rm -rf /var/lib/apt/lists/*
-
-COPY . .
+FROM base AS python-deps
 
 # Install pipenv and compilation dependencies
 RUN pip install -U virtualenv pipenv
@@ -19,9 +20,20 @@ COPY Pipfile.lock .
 RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy
 RUN PIPENV_VENV_IN_PROJECT=1 pipenv install gunicorn
 
+FROM base AS runtime
+
+# Copy virtual env from python-deps stage
+COPY --from=python-deps /.venv /.venv
+ENV PATH="/.venv/bin:$PATH"
+
+# Create app workdir
+RUN mkdir /app
+WORKDIR /app
+COPY . .
 RUN bash -c "adduser --disabled-login --quiet --gecos app app &&  \
              chmod -R o+r /app/ && \
              chmod o+x /app/run.sh"
 USER app
 
+# Expose main port
 EXPOSE 8080
diff --git a/VERSION b/VERSION
index ec70f755..400084b1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.6.6
+1.6.7
-- 
GitLab