Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alexander #2

Merged
merged 2 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
docker-compose.yml
Dockerfile


# Django #
*.log
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Använd en officiell Python-runtime som en föräldrabild
FROM python:3.10-slim
# Ange arbetsmappen i behållaren till /app
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
# Lägg till innehållet i den aktuella katalogen till behållaren vid /app

EXPOSE 8000
# Kör app.py när behållaren startar
CMD ["python", "blog_project/manage.py", "runserver","0.0.0.0:8000"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ In this assignment, you will containerize a Django application, deploy it using
1. Create a kubernetes deployment yaml file, that uses the Docker image from step 2
- remember to export port 8000

2. Crete a kubernetes service yaml file
2. Create a kubernetes service yaml file

3. Apply the kubernetes development and servics configuration

Expand Down
1 change: 1 addition & 0 deletions blog_project/manage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
print(1)
"""Django's command-line utility for administrative tasks."""
import os
import sys
Expand Down
11 changes: 11 additions & 0 deletions blog_project/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: my-app
ports:
- protocol: TCP
port: 80
targetPort: 8000
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Django==5.0.6
djangorestframework==3.15.1
psycopg2-binary
psycopg2-binary