First commit
This commit is contained in:
18
.devcontainer/Dockerfile
Normal file
18
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
# Use the official Python image.
|
||||
# More info: https://hub.docker.com/_/python
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Set up the container for Python development
|
||||
WORKDIR /workspace
|
||||
COPY requirements.txt /workspace
|
||||
|
||||
# Install Python dependencies
|
||||
RUN pip install --upgrade pip
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
# Install additional packages if needed
|
||||
# RUN apt-get update && apt-get install -y <package_name>
|
||||
|
||||
# Expose port 8000 to access Django
|
||||
EXPOSE 8000
|
||||
|
||||
21
.devcontainer/devcontainer.json
Normal file
21
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,21 @@
|
||||
i{
|
||||
"name": "Django DevContainer",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "web",
|
||||
"workspaceFolder": "/workspace",
|
||||
"settings": {
|
||||
"terminal.integrated.defaultProfile.linux": "/bin/bash",
|
||||
"python.pythonPath": "/usr/local/bin/python"
|
||||
},
|
||||
"extensions": [
|
||||
"ms-python.python",
|
||||
"ms-python.vscode-pylance",
|
||||
"ms-python.flake8"
|
||||
],
|
||||
"postCreateCommand": "pip install -r requirements.txt",
|
||||
"forwardPorts": [8000],
|
||||
"remoteEnv": {
|
||||
"DJANGO_SETTINGS_MODULE": "myproject.settings"
|
||||
}
|
||||
}
|
||||
|
||||
29
.devcontainer/docker-compose.yml
Normal file
29
.devcontainer/docker-compose.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
command: python manage.py runserver 0.0.0.0:8000
|
||||
volumes:
|
||||
- .:/workspace
|
||||
ports:
|
||||
- "8000:8000"
|
||||
depends_on:
|
||||
- db
|
||||
environment:
|
||||
- DJANGO_SETTINGS_MODULE=bookings_app.settings
|
||||
|
||||
db:
|
||||
image: postgres:13
|
||||
environment:
|
||||
POSTGRES_USER: user
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: mydatabase
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
|
||||
Reference in New Issue
Block a user