-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ai-project-enhancement
- Loading branch information
Showing
24 changed files
with
1,257 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,47 @@ | ||
FROM python:3.11.2 | ||
# Stage 1: Build stage | ||
FROM python:3.11.2 AS builder | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
RUN mkdir /blt | ||
WORKDIR /blt | ||
COPY . /blt | ||
|
||
|
||
# Install PostgreSQL dependencies | ||
# Install system dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y postgresql-client libpq-dev && \ | ||
apt-get install -y postgresql-client libpq-dev \ | ||
libmemcached11 libmemcachedutil2 libmemcached-dev libz-dev \ | ||
dos2unix && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install pylibmc dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
libmemcached11 \ | ||
libmemcachedutil2 \ | ||
libmemcached-dev \ | ||
libz-dev | ||
|
||
|
||
RUN pip install poetry | ||
# Install Poetry and dependencies | ||
RUN pip install poetry | ||
RUN poetry config virtualenvs.create false | ||
COPY pyproject.toml poetry.lock* ./ | ||
RUN poetry install | ||
|
||
# Install additional Python packages | ||
RUN pip install opentelemetry-api opentelemetry-instrumentation | ||
|
||
# Install dos2unix | ||
RUN apt-get update && apt-get install -y dos2unix | ||
# Stage 2: Runtime stage | ||
FROM python:3.11.2-slim | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
WORKDIR /blt | ||
|
||
# Copy only necessary files from builder stage | ||
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages | ||
COPY --from=builder /usr/local/bin /usr/local/bin | ||
|
||
# Add entrypoint | ||
# Install runtime system dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y postgresql-client libpq-dev \ | ||
libmemcached11 libmemcachedutil2 dos2unix && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
RUN dos2unix .env Dockerfile docker-compose.yml entrypoint.sh ./blt/settings.py | ||
RUN chmod +x /entrypoint.sh | ||
# Copy application code | ||
COPY . /blt | ||
|
||
# Convert line endings and set permissions | ||
RUN dos2unix .env Dockerfile docker-compose.yml entrypoint.sh ./blt/settings.py | ||
RUN chmod +x /blt/entrypoint.sh | ||
|
||
ENTRYPOINT [ "./entrypoint.sh" ] | ||
CMD [ "poetry", "run", "python", "manage.py", "runserver", "0.0.0.0:8000" ] | ||
ENTRYPOINT ["/blt/entrypoint.sh"] | ||
CMD ["poetry", "run", "python", "manage.py", "runserver", "0.0.0.0:8000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.