From d81df6452a80b341d322d0e9ed19d1b4ffe11808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Sat, 9 Nov 2024 11:22:21 +0100 Subject: [PATCH] add dev container --- .devcontainer/devcontainer.json | 21 +++++++++++++++++++++ devcontainer.Dockerfile | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 devcontainer.Dockerfile diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..fce9abb --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "Django Time Tracker", + "dockerFile": "Dockerfile", + "customizations": { + "vscode": { + "settings": { + "python.pythonPath": "/usr/local/bin/python", + "python.defaultInterpreterPath": "/usr/local/bin/python", + "terminal.integrated.defaultProfile.linux": "bash" + }, + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "ms-azuretools.vscode-docker" + ] + } + }, + "forwardPorts": [8000], + "postCreateCommand": "poetry install && poetry run python manage.py migrate", + "remoteUser": "vscode" + } diff --git a/devcontainer.Dockerfile b/devcontainer.Dockerfile new file mode 100644 index 0000000..0215e3b --- /dev/null +++ b/devcontainer.Dockerfile @@ -0,0 +1,21 @@ +FROM python:3.13-slim + +# Set up environment +ENV PYTHONUNBUFFERED=1 +WORKDIR /workspace + +# Install Poetry +RUN apt-get update && apt-get install -y curl \ + && rm -rf /var/lib/apt/lists/* +RUN curl -sSL https://install.python-poetry.org | python3 - +ENV PATH="/root/.local/bin:$PATH" + +# Copy pyproject.toml and poetry.lock for dependency installation +COPY pyproject.toml poetry.lock* ./ +RUN poetry install --no-root + +# Copy the rest of the application code +COPY . . + +# Set up Django development server +EXPOSE 8000