Fix Dockerfile for poetry
This commit is contained in:
parent
fc8f22432c
commit
d2f94c7bec
2 changed files with 41 additions and 29 deletions
56
Dockerfile
56
Dockerfile
|
@ -1,51 +1,63 @@
|
||||||
ARG DEBIAN_RELEASE=buster
|
ARG DEBIAN_RELEASE=buster
|
||||||
FROM debian:$DEBIAN_RELEASE
|
FROM debian:$DEBIAN_RELEASE AS builder
|
||||||
LABEL maintainer="Jan Dittberner <jan@dittberner.info>"
|
|
||||||
|
ARG GVAAPP=gva
|
||||||
|
ARG POETRY_VERSION=1.3.1
|
||||||
|
|
||||||
ENV LC_ALL=C.UTF-8
|
ENV LC_ALL=C.UTF-8
|
||||||
ENV LANG=C.UTF-8
|
ENV LANG=C.UTF-8
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
build-essential \
|
build-essential \
|
||||||
dumb-init \
|
curl \
|
||||||
gettext \
|
|
||||||
git \
|
git \
|
||||||
|
libpq-dev \
|
||||||
python3-dev \
|
python3-dev \
|
||||||
python3-pip \
|
|
||||||
python3-setuptools \
|
python3-setuptools \
|
||||||
python3-virtualenv \
|
python3-virtualenv \
|
||||||
python3-wheel \
|
python3-wheel
|
||||||
&& apt-get clean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*.*
|
|
||||||
|
|
||||||
RUN python3 -m pip install --prefix=/usr/local pipenv
|
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/root/.local POETRY_VERSION=$POETRY_VERSION python3 - \
|
||||||
|
&& /root/.local/bin/poetry config virtualenvs.in-project true
|
||||||
|
|
||||||
|
WORKDIR /srv/$GVAAPP
|
||||||
|
|
||||||
|
COPY poetry.lock pyproject.toml /srv/$GVAAPP/
|
||||||
|
|
||||||
|
RUN /root/.local/bin/poetry install --only=main
|
||||||
|
|
||||||
|
FROM debian:$DEBIAN_RELEASE
|
||||||
|
LABEL maintainer="Jan Dittberner <jan@dittberner.info>"
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
libpq-dev \
|
ca-certificates \
|
||||||
|
dumb-init \
|
||||||
|
gettext \
|
||||||
postgresql-client \
|
postgresql-client \
|
||||||
|
python3 \
|
||||||
|
python3-pip \
|
||||||
|
python3-wheel \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*.*
|
&& rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
|
||||||
|
|
||||||
ARG GVAGID=2000
|
|
||||||
ARG GVAUID=2000
|
|
||||||
|
|
||||||
ARG GVAAPP=gva
|
ARG GVAAPP=gva
|
||||||
|
ARG GVAGID=2000
|
||||||
|
ARG GVAUID=2000
|
||||||
|
|
||||||
VOLUME /srv/$GVAAPP/media /srv/$GVAAPP/static
|
VOLUME /srv/$GVAAPP/media /srv/$GVAAPP/static
|
||||||
|
|
||||||
WORKDIR /srv/$GVAAPP
|
WORKDIR /srv/$GVAAPP
|
||||||
|
|
||||||
COPY Pipfile Pipfile.lock /srv/$GVAAPP/
|
|
||||||
|
|
||||||
RUN addgroup --gid $GVAGID $GVAAPP ; \
|
RUN addgroup --gid $GVAGID $GVAAPP ; \
|
||||||
adduser --home /home/$GVAAPP --shell /bin/bash --uid $GVAUID --gid $GVAGID --disabled-password --gecos "User for gnuviechadmin component $GVAAPP" $GVAAPP
|
adduser --home /home/$GVAAPP --shell /bin/bash --uid $GVAUID --gid $GVAGID --disabled-password \
|
||||||
|
--gecos "User for gnuviechadmin component $GVAAPP" $GVAAPP
|
||||||
|
|
||||||
|
COPY --chown=$GVAAPP:$GVAAPP --from=builder /srv/$GVAAPP/.venv /srv/$GVAAPP/.venv
|
||||||
|
|
||||||
USER $GVAAPP
|
USER $GVAAPP
|
||||||
RUN python3 -m virtualenv --python=python3 /home/$GVAAPP/$GVAAPP-venv ; \
|
|
||||||
/home/$GVAAPP/$GVAAPP-venv/bin/python3 -m pip install -U pip ; \
|
|
||||||
VIRTUAL_ENV=/home/$GVAAPP/$GVAAPP-venv pipenv install --deploy --ignore-pipfile --dev
|
|
||||||
|
|
||||||
VOLUME /srv/$GVAAPP
|
VOLUME /srv/$GVAAPP
|
||||||
|
|
||||||
|
|
2
gva.sh
2
gva.sh
|
@ -15,7 +15,7 @@ done
|
||||||
|
|
||||||
echo " db is ready"
|
echo " db is ready"
|
||||||
|
|
||||||
. /home/gva/gva-venv/bin/activate
|
. /srv/gva/.venv/bin/activate
|
||||||
cd /srv/gva/gnuviechadmin
|
cd /srv/gva/gnuviechadmin
|
||||||
python3 manage.py compilemessages
|
python3 manage.py compilemessages
|
||||||
python3 manage.py collectstatic --noinput
|
python3 manage.py collectstatic --noinput
|
||||||
|
|
Loading…
Reference in a new issue