Giter VIP home page Giter VIP logo

docker-container-remote-development's Introduction

Overview

Docker container sample for Visual Studio Code Remote Development.

Official reference: https://code.visualstudio.com/docs/remote/containers

Usage

Copy Dockerfile to .devcontainer directory in workspace, and customize Dockerfile.

Simple

. (workspace)
├── .devcontainer
|   ├──Dockerfile
|   └── devcontainer.json (generated by Visual Studio Code)
|
other files

devcontainer.json sample:

{
    "name": "Python 3.8",
    "dockerFile": "Dockerfile",
    "settings": {
        "terminal.integrated.shell.linux": "/bin/bash",
        "python.pythonPath": "/usr/local/bin/python",
        "python.linting.pylintPath": "/usr/local/bin/pylint",
        "python.linting.pylintEnabled": false,
        "python.linting.flake8Enabled": true,
        "python.linting.mypyEnabled": true,
        "editor.formatOnSave": true,
        "python.linting.lintOnSave": true
    },
    "extensions": [
        "ms-python.python"
    ]
}

docker-compose

. (workspace)
├── .devcontainer
|   ├── devcontainer.json (generated by Visual Studio Code)
|   ├── docker-compose.yml (docker-compose settings)
|   ├── devcontainer.extend.yml (for remove develop settings)
|   ├── python-app
|   |   └── Dockerfile
|   └── db
|       └── Dockerfile
|
other files

devcontainer.json sample:

{
    "name": "Python with database App",
    // "dockerComposeFile" is used for -f option of docker-compose command.
    "dockerComposeFile": [
        "docker-compose.yml",
        "devcontainer.extend.yml"
    ],
    "service": "python-app",
    "workspaceFolder": "/workspace",
    "settings": {
        "terminal.integrated.shell.linux": "/bin/bash",
        "python.pythonPath": "/usr/local/bin/python",
        "python.linting.pylintPath": "/usr/local/bin/pylint",
        "python.linting.pylintEnabled": false,
        "python.linting.flake8Enabled": true,
        "python.linting.mypyEnabled": true,
        "editor.formatOnSave": true,
        "python.linting.lintOnSave": true
    },
    "extensions": [
        "ms-python.python"
    ],
    "shutdownAction": "stopCompose"
}

docker-compose.yml sample:

version: "3"
services:
  python-app:
    image: python-app
    container_name: python-app
    build:
      context: ./python-app
      dockerfile: Dockerfile
    networks:
      - python-app-network
  db:
    image: db
    container_name: db
    build:
      context: ./db
      dockerfile: Dockerfile
    networks:
      - python-app-network

networks:
  python-app-network:
    name: python-app-network
    driver: bridge

devcontainer.extend.yml sample:

version: "3"
services:
  python-app:
    # tty is required if Visual Studio Code attaches to this container.
    tty: true
    # '/workspace' is value of 'workspaceFolder' in '.devcontainer/devcontainer.json'.
    volumes:
      - ./:/workspace:cached

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.