From 6a379b264d52d36b052370eec298140ec067ab9b Mon Sep 17 00:00:00 2001 From: Trey <73353716+TreyWW@users.noreply.github.com> Date: Sun, 20 Oct 2024 22:16:25 +0100 Subject: [PATCH] Reverted Dockerfile --- infrastructure/backend/Dockerfile | 32 ++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/infrastructure/backend/Dockerfile b/infrastructure/backend/Dockerfile index a07380e1..b011b631 100644 --- a/infrastructure/backend/Dockerfile +++ b/infrastructure/backend/Dockerfile @@ -9,28 +9,33 @@ ENV POETRY_NO_INTERACTION=1 \ WORKDIR /MyFinances -# Install build dependencies including C++ compiler -RUN apk add --no-cache --virtual .build-deps \ - gcc \ - g++ \ - musl-dev \ - libffi-dev \ - mariadb-dev \ - postgresql-dev \ - curl - -# Copy only dependency files first for better caching +#RUN #apk --no-cache --update add \ +# mariadb-connector-c-dev \ +# py-pip \ +# musl-dev \ +# gcc \ +# mariadb-dev \ +# libffi-dev + + +# Install build dependencies +RUN apk add --virtual .build-deps py-pip musl-dev gcc + COPY pyproject.toml poetry.lock ./ +# Install MySQL dependencies and packages if DATABASE_TYPE is mysql RUN if [ "${DATABASE_TYPE}" = "mysql" ]; then \ + apk add --no-cache mariadb-dev && \ poetry install --only mysql; \ fi -# Install PostgreSQL dependencies if TESTING is not true or DATABASE_TYPE is postgres +# Install PostgreSQL dependencies and packages if TESTING is not true or DATABASE_TYPE is postgres RUN if [ "${TESTING}" != "true" ] || [ "${DATABASE_TYPE}" = "postgres" ]; then \ + apk add --no-cache postgresql-dev && \ poetry install --only postgres; \ fi +# Clean up build dependencies RUN apk del .build-deps RUN poetry install --without dev,mysql,postgres --no-root && rm -rf $POETRY_CACHE_DIR @@ -41,4 +46,5 @@ RUN chmod +x infrastructure/backend/scripts/* ENTRYPOINT ["sh", "infrastructure/backend/scripts/entrypoint.sh"] -EXPOSE 10012 9012 +EXPOSE 10012 +EXPOSE 9012