diff --git a/.env.sample b/.devcontainer/.env.sample similarity index 100% rename from .env.sample rename to .devcontainer/.env.sample diff --git a/Dockerfile.dev b/.devcontainer/Dockerfile similarity index 55% rename from Dockerfile.dev rename to .devcontainer/Dockerfile index 8ddeeec5..8f39ee42 100644 --- a/Dockerfile.dev +++ b/.devcontainer/Dockerfile @@ -2,14 +2,18 @@ FROM eligibility_server:latest USER root -# install tooling: curl, git, jq, ssh -# install python tooling: pip, flake8, pre-commit +# install container tooling RUN apt-get update \ && apt-get install -qq --no-install-recommends curl git jq ssh build-essential \ && python -m pip install --upgrade pip -RUN pip install --no-cache-dir flake8 pre-commit coverage pytest +# install python tooling +RUN pip install --no-cache-dir flake8 pre-commit -# install docs tooling: +# install docs tooling COPY docs/requirements.txt docs/requirements.txt RUN pip install --no-cache-dir -r docs/requirements.txt + +# install test tooling +COPY tests/requirements.txt tests/requirements.txt +RUN pip install -r tests/requirements.txt diff --git a/docker-compose.yml b/.devcontainer/compose.yml similarity index 71% rename from docker-compose.yml rename to .devcontainer/compose.yml index 28370500..c200b300 100644 --- a/docker-compose.yml +++ b/.devcontainer/compose.yml @@ -2,17 +2,17 @@ version: "3.8" services: server: - build: . + build: .. env_file: .env image: eligibility_server:latest ports: - "5000" volumes: - - ./:/home/calitp/app/ + - ../:/home/calitp/app/ dev: build: - context: . - dockerfile: Dockerfile.dev + context: .. + dockerfile: .devcontainer/Dockerfile command: sleep infinity entrypoint: [] env_file: .env @@ -20,7 +20,7 @@ services: ports: - "5000" volumes: - - ./:/home/calitp/app/ + - ../:/home/calitp/app/ docs: image: eligibility_server:dev entrypoint: mkdocs @@ -28,4 +28,4 @@ services: ports: - "8000" volumes: - - ./:/home/calitp/app:cached + - ../:/home/calitp/app:cached diff --git a/.devcontainer.json b/.devcontainer/devcontainer.json similarity index 82% rename from .devcontainer.json rename to .devcontainer/devcontainer.json index a500fdab..e06e34c2 100644 --- a/.devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,11 +1,11 @@ // For format details, see https://aka.ms/vscode-remote/devcontainer.json { "name": "cal-itp/eligibility-server", - "dockerComposeFile": ["./docker-compose.yml"], + "dockerComposeFile": ["compose.yml"], "service": "dev", "runServices": ["dev", "docs"], "workspaceFolder": "/home/calitp/app", - "postAttachCommand": ["/bin/bash", "bin/pre-commit.sh"], + "postAttachCommand": ["/bin/bash", ".devcontainer/pre-commit.sh"], // Set *default* container specific settings.json values on container create. "settings": { @@ -21,6 +21,6 @@ "extensions": [ "batisteo.vscode-django", "ms-python.python", - "ms-python.vscode-pylance", + "ms-python.vscode-pylance" ] } diff --git a/bin/pre-commit.sh b/.devcontainer/pre-commit.sh similarity index 100% rename from bin/pre-commit.sh rename to .devcontainer/pre-commit.sh diff --git a/docs/README.md b/docs/README.md index 9f924f4c..a66a2e16 100644 --- a/docs/README.md +++ b/docs/README.md @@ -23,6 +23,8 @@ Running the application locally is possible with [Docker and Docker Compose](htt ### Build the Docker container for local development ```bash +cd .devcontainer +cp .env.sample .env docker compose build server ``` diff --git a/docs/getting-started.md b/docs/getting-started.md index db3b5df4..9f13bece 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -18,6 +18,7 @@ cd eligibility-server Use the sample as the template. ```bash +cd .devcontainer cp .env.sample .env ``` @@ -29,6 +30,7 @@ The .env file specifies two values: ### Build image using Docker Compose ```bash +cd .devcontainer docker compose build --no-cache server ```