-
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.
- Loading branch information
Showing
3 changed files
with
74 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM python:3.8.2 | ||
|
||
ENV PYTHONBUFFERED 1 | ||
ENV PYTHONWRITEBYTECODE 1 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y netcat | ||
|
||
ENV APP=/app | ||
|
||
# Change the workdir. | ||
WORKDIR $APP | ||
|
||
# Install the requirements | ||
COPY requirements.txt $APP | ||
|
||
RUN pip3 install -r requirements.txt | ||
|
||
# Copy the rest of the files | ||
COPY . $APP | ||
|
||
EXPOSE 8000 | ||
|
||
RUN chmod +x /app/entrypoint.sh | ||
|
||
ENTRYPOINT ["/bin/bash","/app/entrypoint.sh"] | ||
|
||
CMD ["gunicorn", "--bind", ":8000", "--workers", "3", "djangobackend.wsgi"] |
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,29 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
run: dealership | ||
name: dealership | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
run: dealership | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 25% | ||
maxUnavailable: 25% | ||
type: RollingUpdate | ||
template: | ||
metadata: | ||
labels: | ||
run: dealership | ||
spec: | ||
containers: | ||
- image: us.icr.io/sn-labs-seymoneagugn/dealership:latest | ||
imagePullPolicy: Always | ||
name: dealership | ||
ports: | ||
- containerPort: 8000 | ||
protocol: TCP | ||
restartPolicy: Always |
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,17 @@ | ||
#!/bin/sh | ||
|
||
if [ "$DATABASE" = "postgres" ]; then | ||
echo "Waiting for postgres..." | ||
|
||
while ! nc -z $DATABASE_HOST $DATABASE_PORT; do | ||
sleep 0.1 | ||
done | ||
|
||
echo "PostgreSQL started" | ||
fi | ||
|
||
# Make migrations and migrate the database. | ||
echo "Making migrations and migrating the database. " | ||
python manage.py makemigrations main --noinput | ||
python manage.py migrate --noinput | ||
exec "$@" |