Skip to content

Commit

Permalink
Change docker base image due to python dep build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
robbizbal committed Oct 31, 2024
1 parent ce7e794 commit 9e5a481
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
29 changes: 12 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
FROM alpine:latest
FROM python:3.12-bookworm

# set metadata
LABEL maintainer="culmat, trichie, robbizbal" \
org.opencontainers.image.description="Yo-Yo-Maskr application Docker image" \
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/

Expand All @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh
export PATH="$HOME/.local/bin:$PATH"
pipx install poetry
pipx ensurepath
. ~/.bashrc
Expand Down

0 comments on commit 9e5a481

Please sign in to comment.