From 9e5a4816d922667362cf61de983bdeda1a70e50c Mon Sep 17 00:00:00 2001 From: robbizbal Date: Thu, 31 Oct 2024 14:39:01 +0100 Subject: [PATCH] Change docker base image due to python dep build errors --- Dockerfile | 29 ++++++++++++----------------- setup.sh | 2 ++ 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 43158e7..8212e81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:latest +FROM python:3.12-bookworm # set metadata LABEL maintainer="culmat, trichie, robbizbal" \ @@ -6,27 +6,13 @@ LABEL maintainer="culmat, trichie, robbizbal" \ version="0.1.0" # set poetry environment variables -ARG POETRY_FLAGS="--without dev" +ARG POETRY_FLAGS="--only main" # set default environment variables ENV OLLAMA_BASE_URL=http://localhost:11434 \ OLLAMA_MODEL=llama3.2:latest \ HTTPX_CLIENT_VERIFY= -# install Python and dependencies -RUN apk add --no-cache --update \ - python3 \ - py3-pip \ - gcc \ - python3-dev \ - make \ - bash \ - && rm -rf ~/.cache/* /usr/local/share/man /tmp/* - -RUN python3 -m pip install pipx --break-system-packages \ - && python3 -m pipx ensurepath \ - && python3 -m pipx completions - # add app src COPY . /app/ @@ -37,11 +23,20 @@ WORKDIR /app RUN chmod +x entrypoint.sh setup.sh # create user -RUN adduser -Ds /bin/bash anon && chown -R anon: /app +#RUN useradd -ms /bin/bash anon && chown -R anon: /app +RUN useradd -ms /bin/bash -G 0 anon + +# set permissions - for OpenShift +RUN chgrp -R 0 /app && chmod -R g+rwX /app # switch to user USER anon +RUN python3 -m pip install --upgrade pip \ + && python3 -m pip install pipx \ + && python3 -m pipx ensurepath \ + && python3 -m pipx completions + # run app setup script RUN "./setup.sh" diff --git a/setup.sh b/setup.sh index 6da4c03..a822f95 100755 --- a/setup.sh +++ b/setup.sh @@ -1,3 +1,5 @@ +#!/bin/sh +export PATH="$HOME/.local/bin:$PATH" pipx install poetry pipx ensurepath . ~/.bashrc