From 079698e697ba0e1cd09962d1a018e02850b1382a Mon Sep 17 00:00:00 2001 From: DavidHenryThoreau Date: Wed, 15 May 2024 12:28:09 +0200 Subject: [PATCH] feat: add alpine based for images Based on work of @jovandeginste see : https://github.com/SamR1/FitTrackee/pull/463#issuecomment-1919761534 --- Dockerfile | 16 +++++++++++----- fittrackee_client/Dockerfile | 7 ++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index ac910520c..e82a19ac4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM python:3.10 +#FROM python:3.10 +#FROM python:3.10-slim +FROM python:3.10-alpine # set working directory RUN mkdir -p /usr/src/app @@ -7,13 +9,17 @@ WORKDIR /usr/src/app # copy source files COPY . /usr/src/app +# install gcc +#RUN apt update && apt install gcc python3-dev -y +RUN apk add linux-headers gcc musl-dev libffi-dev py-pip bash + # install requirements ENV VIRTUAL_ENV=/opt/venv RUN python3 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" -RUN pip install --upgrade pip -RUN pip install poetry -RUN . $VIRTUAL_ENV/bin/activate && poetry install --no-interaction --quiet +RUN pip install --no-cache-dir --upgrade pip +RUN pip install --no-cache-dir poetry +RUN . $VIRTUAL_ENV/bin/activate && poetry install --no-interaction # run fittrackee server -CMD flask run --with-threads -h 0.0.0.0 \ No newline at end of file +CMD flask run --with-threads -h 0.0.0.0 diff --git a/fittrackee_client/Dockerfile b/fittrackee_client/Dockerfile index e1c9e5f3a..cb59f0fd3 100644 --- a/fittrackee_client/Dockerfile +++ b/fittrackee_client/Dockerfile @@ -1,4 +1,4 @@ -FROM node:18 +FROM node:18-alpine MAINTAINER SamR1@users.noreply.github.com @@ -18,7 +18,8 @@ ENV VITE_APP_API_URL $VITE_APP_API_URL # install dependencies COPY package.json /usr/src/app/package.json COPY yarn.lock /usr/src/app/yarn.lock -RUN yarn install --silent +RUN yarn install --silent && yarn cache clean --force +RUN npm run build # copy source -COPY . /usr/src/app/ \ No newline at end of file +COPY . /usr/src/app/