Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
separate development and production build images
Browse files Browse the repository at this point in the history
  • Loading branch information
alimaktabi committed Sep 16, 2024
1 parent 34b4e89 commit 537b73b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 16 deletions.
20 changes: 4 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
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 curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustc --version && cargo --version

# Use an official Python runtime as a parent image
FROM python:3.10.11

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
Expand All @@ -23,6 +11,7 @@ WORKDIR /usr/src/app
RUN apt update && apt install gcc



# RUN apt-get update && \
# apt-get install -y --no-install-recommends \
# build-essential \
Expand All @@ -38,7 +27,6 @@ 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


# Copy project
Expand All @@ -47,4 +35,4 @@ COPY ./start.sh .
COPY ./celery.sh .


# RUN pypy3 manage.py collectstatic --noinput
RUN python manage.py collectstatic --noinput
50 changes: 50 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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 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 work directory
WORKDIR /usr/src/app

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 pip install --upgrade pip
COPY ./requirements.txt .
RUN pip install -r requirements.txt

RUN ln -s /usr/local/bin/pypy3 /usr/local/bin/python


# Copy project
COPY ./src .
COPY ./start.sh .
COPY ./celery.sh .


# RUN pypy3 manage.py collectstatic --noinput

0 comments on commit 537b73b

Please sign in to comment.