From ad049bda8b15e365a93cc947d02af4925e44d7d5 Mon Sep 17 00:00:00 2001 From: Philippe Matray Date: Wed, 14 Feb 2024 13:42:42 +0100 Subject: [PATCH] create basic dev container --- .devcontainer/Dockerfile | 24 ++++++++++++++++++++++++ .devcontainer/devcontainer.json | 19 +++++++++++++++++++ README.md | 1 + 3 files changed, 44 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..eedfba4 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,24 @@ +# Use the official Microsoft .NET image. +FROM mcr.microsoft.com/dotnet/sdk:8.0 + +# Set the working directory inside the container to /workspace. +WORKDIR /workspace + +# Install system dependencies required for your project here. +# Update the package lists and install ssh and procps (which provides ps). +RUN apt-get update && apt-get install -y \ + ssh \ + procps \ + && rm -rf /var/lib/apt/lists/* + +# Copy the solution file +COPY MasterCommander.sln . + +# Copy the entire src directory and restore as distinct layers +COPY src/ ./src/ +RUN for file in $(ls src/**/*.csproj); do dotnet restore $file; done + +# Optionally, copy other directories if needed, e.g., for tests or additional source files. + +# Set the working directory to where most of the work will be done +WORKDIR /workspace/src diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..51da82b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +{ + "name": "MasterCommander Dev Container", + "build": { + "context": "..", + "dockerfile": ".devcontainer/Dockerfile" + }, + "settings": { + "terminal.integrated.defaultProfile.linux": "bash" + }, + "extensions": [ + "ms-dotnettools.csharp" + // Add other extensions relevant to your project here + ], + "forwardPorts": [ + // Add any ports your application uses + ], + "postCreateCommand": "dotnet restore", + "remoteUser": "root" +} diff --git a/README.md b/README.md index 4e78ee4..553e84c 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Write code, not commands. MasterCommander provides a simple, consistent interfac [![GitHub contributors](https://img.shields.io/github/contributors/phmatray/MasterCommander)](https://github.com/phmatray/MasterCommander/graphs/contributors) [![GitHub last commit](https://img.shields.io/github/last-commit/phmatray/MasterCommander)](https://github.com/phmatray/MasterCommander/commits/master) +[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/phmatray/MasterCommander) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/bdd7b46c04534d8e958fda9dce1b0366)](https://app.codacy.com/gh/phmatray/MasterCommander/dashboard) [![codecov](https://codecov.io/gh/phmatray/MasterCommander/branch/main/graph/badge.svg?token=041C4QKW6O)](https://app.codecov.io/gh/phmatray/MasterCommander/tree/main)