From 16e32f57d8ce350ea0d656614963fcf659490dc8 Mon Sep 17 00:00:00 2001 From: Philipp Grathwohl Date: Sat, 27 Nov 2021 15:21:05 +0100 Subject: [PATCH] Update docker file to install craftbeerpi Also install cbpi-ui from avollkopf repository. --- Dockerfile | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4252cd3..b973b7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,43 @@ -FROM python:3.5.6-stretch +FROM alpine:latest as download +RUN apk --no-cache add curl && mkdir /downloads +# Download installation files +RUN curl https://github.com/avollkopf/craftbeerpi4-ui/archive/main.zip -L -o ./downloads/cbpi-ui.zip -WORKDIR /usr/src/app +FROM python:3.7-slim -COPY dist/cbpi-0.0.1.tar.gz ./ -RUN pip install cbpi-0.0.1.tar.gz --no-cache-dir +# Install dependencies +RUN apt-get update \ + && apt-get upgrade -y +RUN apt-get install --no-install-recommends -y \ + libatlas-base-dev \ + libffi-dev \ + python3-pip \ + && rm -rf /var/lib/apt/lists/* -COPY . . +RUN python -m pip install --upgrade pip setuptools wheel -EXPOSE 8080 +WORKDIR /cbpi +# Create non-root user working directory +RUN groupadd -g 1000 -r craftbeerpi \ + && useradd -u 1000 -r -s /bin/false -g craftbeerpi craftbeerpi \ + && chown craftbeerpi:craftbeerpi /cbpi -CMD [ "cbpi" ] +# Install craftbeerpi from source +COPY . /cbpi-src +RUN pip3 install --no-cache-dir /cbpi-src +# Install craftbeerpi-ui +COPY --from=download /downloads /downloads +RUN pip3 install --no-cache-dir /downloads/cbpi-ui.zip +# Clean up installation files +RUN rm -rf /downloads /cbpi-src + +USER craftbeerpi + +RUN cbpi setup + +EXPOSE 8000 + +# Start cbpi +CMD ["cbpi", "start"] \ No newline at end of file