-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from mikeiken/dev
Dev
- Loading branch information
Showing
122 changed files
with
5,779 additions
and
1,581 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
./env-inject.ps1 | ||
python ./django/tamprog/manage.py $args |
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,36 +1,53 @@ | ||
# Use the official Python image from the Alpine version | ||
FROM python:3.9-alpine | ||
# Build stage | ||
FROM python:3.9-alpine AS builder | ||
|
||
# Set environment variables | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
ENV PYTHONDONTWRITEBYTECODE=1 \ | ||
PYTHONUNBUFFERED=1 | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /usr/src/app | ||
|
||
# Install dependencies | ||
RUN apk update && \ | ||
apk add --no-cache gcc musl-dev libffi-dev openssl-dev make postgresql-dev curl | ||
# Install build dependencies and compile requirements | ||
RUN apk add --no-cache --virtual .build-deps \ | ||
gcc \ | ||
musl-dev \ | ||
libffi-dev \ | ||
openssl-dev \ | ||
make \ | ||
postgresql-dev \ | ||
&& pip install --upgrade pip | ||
|
||
# Copy the requirements file to the working directory | ||
COPY requirements.txt . | ||
|
||
# Install Python dependencies | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copy the rest of the application code to the working directory | ||
COPY . . | ||
# Runtime stage | ||
FROM python:3.9-alpine | ||
|
||
ENV PYTHONDONTWRITEBYTECODE=1 \ | ||
PYTHONUNBUFFERED=1 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Install only runtime dependencies | ||
RUN apk add --no-cache libpq curl | ||
|
||
# Copy Python packages from builder | ||
COPY --from=builder /usr/local/lib/python3.9/site-packages/ /usr/local/lib/python3.9/site-packages/ | ||
COPY --from=builder /usr/local/bin/ /usr/local/bin/ | ||
|
||
# Copy only necessary project files | ||
COPY tamprog/ tamprog/ | ||
COPY entrypoint.sh . | ||
|
||
# Collect static files | ||
RUN python tamprog/manage.py collectstatic --noinput | ||
# Collect static files and clean up in single layer | ||
RUN python tamprog/manage.py collectstatic --noinput \ | ||
&& find . -type d -name __pycache__ -exec rm -r {} + \ | ||
&& rm -rf /root/.cache /tmp/* | ||
|
||
# Expose the port the application will run on | ||
EXPOSE 8000 | ||
|
||
# Add health check | ||
HEALTHCHECK --interval=10s --timeout=5s --retries=5 CMD curl --fail http://localhost:8000/admin || exit 1 | ||
|
||
WORKDIR /usr/src/app/tamprog | ||
|
||
# Run migrations and start the Django development server | ||
ENTRYPOINT ["/bin/sh", "../entrypoint.sh"] |
Oops, something went wrong.