Skip to content

Commit

Permalink
Merge pull request #19 from hynet-mel/docker-alpine-variant
Browse files Browse the repository at this point in the history
  • Loading branch information
ruecat authored Jan 22, 2024
2 parents 470ce16 + 1ec0dfc commit ac43a62
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 10 additions & 5 deletions dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12
FROM python:3.12-alpine

ARG APPHOMEDIR=code
ARG USERNAME=user
Expand All @@ -11,13 +11,18 @@ WORKDIR /${APPHOMEDIR}
COPY requirements.txt requirements.txt
COPY ./bot /${APPHOMEDIR}

# Configure app home directory
RUN \
apt update -y && apt upgrade -y \
addgroup -g "$USER_GID" "$USERNAME" \
&& adduser --disabled-password -u "$USER_UID" -G "$USERNAME" -h /"$APPHOMEDIR" "$USERNAME" \
&& chown "$USERNAME:$USERNAME" -R /"$APPHOMEDIR"

# Install dependency packages, upgrade pip and then install requirements
RUN \
apk add --no-cache gcc g++ \
&& python -m pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt \
&& groupadd --gid "$USER_GID" "$USERNAME" \
&& useradd --uid "$USER_UID" --gid "$USER_GID" -m "$USERNAME" -d /"$APPHOMEDIR" \
&& chown "$USERNAME:$USERNAME" -R /"$APPHOMEDIR"
&& apk del --no-cache gcc g++

USER ${USERNAME}

Expand Down
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
version: '3.8'
services:
ollama-telegram:
build:
context: .
dockerfile: dockerfile
build: .
container_name: ollama-telegram
restart: on-failure
env_file:
Expand Down

0 comments on commit ac43a62

Please sign in to comment.