From 34333572bf5eaa981147cf046a564c8c48805e29 Mon Sep 17 00:00:00 2001 From: Ali Maktabi Date: Tue, 17 Sep 2024 14:13:31 +0330 Subject: [PATCH] fixed builder dependency copying --- Dockerfile | 146 +++++++++++++++++++++++++++-------------------------- 1 file changed, 74 insertions(+), 72 deletions(-) diff --git a/Dockerfile b/Dockerfile index e916a76..65182fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,103 +1,105 @@ -# # Builder stage -# FROM pypy:3.10 AS builder +# Builder stage +FROM pypy:3.10 AS builder -# # Install dependencies for Rust and Python build requirements -# RUN apt-get update && apt-get install -y \ -# curl \ -# build-essential \ -# libssl-dev \ -# pkg-config \ -# gcc \ -# && rm -rf /var/lib/apt/lists/* +# Install dependencies for Rust and Python build requirements +RUN apt-get update && apt-get install -y \ + curl \ + build-essential \ + libssl-dev \ + pkg-config \ + gcc \ + && rm -rf /var/lib/apt/lists/* -# # Install Rust and Cargo -# RUN curl https://sh.rustup.rs -sSf | sh -s -- -y -# ENV PATH="/root/.cargo/bin:${PATH}" -# RUN rustc --version && cargo --version +# Install Rust and Cargo +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" +RUN rustc --version && cargo --version -# # Set work directory -# WORKDIR /usr/src/app +# Set work directory +WORKDIR /usr/src/app -# # Upgrade pip and install Python dependencies into a virtual environment -# RUN pip install --upgrade pip -# COPY ./requirements.txt . -# RUN pip install -r requirements.txt +# Upgrade pip and install Python dependencies into a virtual environment +RUN pip install --upgrade pip +COPY ./requirements.txt . +RUN pip install -r requirements.txt -# # Final stage (runtime) -# FROM pypy:3.10 +# Final stage (runtime) +FROM pypy:3.10 -# # Set environment variables -# ENV PYTHONDONTWRITEBYTECODE 1 -# ENV PYTHONUNBUFFERED 1 +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 -# # Set work directory -# WORKDIR /usr/src/app +# Set work directory +WORKDIR /usr/src/app -# # Install GCC -# RUN apt update && apt install -y gcc +# Install GCC +RUN apt update && apt install -y gcc -# # Copy installed Python packages from builder stage -# COPY --from=builder /opt/pypy/lib/pypy3.10/ /opt/pypy/lib/pypy3.10/ +# Copy installed Python packages from builder stage +COPY --from=builder /opt/pypy/lib/pypy3.10/ /opt/pypy/lib/pypy3.10/ +# this depends on what you are installing +COPY --from=builder /usr/local/bin /usr/local/bin -# # Link pypy3 to python -# RUN ln -s /usr/local/bin/pypy3 /usr/local/bin/python +# Link pypy3 to python +RUN ln -s /usr/local/bin/pypy3 /usr/local/bin/python -# # Copy project files -# COPY ./src . -# COPY ./start.sh . -# COPY ./celery.sh . +# Copy project files +COPY ./src . +COPY ./start.sh . +COPY ./celery.sh . -# # RUN pypy3 manage.py collectstatic --noinput +# RUN pypy3 manage.py collectstatic --noinput -FROM pypy:3.10 +# FROM pypy:3.10 -RUN apt-get update && apt-get install -y \ - curl \ - build-essential \ - libssl-dev \ - pkg-config \ - && rm -rf /var/lib/apt/lists/* +# RUN apt-get update && apt-get install -y \ +# curl \ +# build-essential \ +# libssl-dev \ +# pkg-config \ +# && rm -rf /var/lib/apt/lists/* -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y -ENV PATH="/root/.cargo/bin:${PATH}" -RUN rustc --version && cargo --version +# RUN curl https://sh.rustup.rs -sSf | sh -s -- -y +# ENV PATH="/root/.cargo/bin:${PATH}" +# RUN rustc --version && cargo --version -# Set environment variables -ENV PYTHONDONTWRITEBYTECODE 1 -ENV PYTHONUNBUFFERED 1 +# # Set environment variables +# ENV PYTHONDONTWRITEBYTECODE 1 +# ENV PYTHONUNBUFFERED 1 -# Set work directory -WORKDIR /usr/src/app +# # Set work directory +# WORKDIR /usr/src/app -RUN apt update && apt install gcc +# RUN apt update && apt install gcc -# RUN apt-get update && \ -# apt-get install -y --no-install-recommends \ -# build-essential \ -# gcc \ -# libpq-dev \ -# libc-dev \ -# netcat-traditional \ -# && apt-get clean && \ -# rm -rf /var/lib/apt/lists/* +# # RUN apt-get update && \ +# # apt-get install -y --no-install-recommends \ +# # build-essential \ +# # gcc \ +# # libpq-dev \ +# # libc-dev \ +# # netcat-traditional \ +# # && apt-get clean && \ +# # rm -rf /var/lib/apt/lists/* -RUN pip install --upgrade pip -COPY ./requirements.txt . -RUN pip install -r requirements.txt +# RUN pip install --upgrade pip +# COPY ./requirements.txt . +# RUN pip install -r requirements.txt -RUN ln -s /usr/local/bin/pypy3 /usr/local/bin/python +# RUN ln -s /usr/local/bin/pypy3 /usr/local/bin/python -# Copy project -COPY ./src . -COPY ./start.sh . -COPY ./celery.sh . +# # Copy project +# COPY ./src . +# COPY ./start.sh . +# COPY ./celery.sh . -# RUN pypy3 manage.py collectstatic --noinput +# # RUN pypy3 manage.py collectstatic --noinput