{"id":8848,"date":"2022-05-07T20:05:29","date_gmt":"2022-05-07T18:05:29","guid":{"rendered":"https:\/\/via-internet.de\/blog\/?p=8848"},"modified":"2022-06-10T18:23:07","modified_gmt":"2022-06-10T16:23:07","slug":"daily-build-a-development-environment-with-docker-and-vs-code","status":"publish","type":"post","link":"https:\/\/via-internet.de\/blog\/2022\/05\/07\/daily-build-a-development-environment-with-docker-and-vs-code\/","title":{"rendered":"Daily: Build a Development Environment with Docker and VS Code"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Working with different software (samples, compilers, demos) always requires an adequate environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because i don&#8217;t want to pollute my normal environment (my running PC), i decided to use a virtual environment with Docker.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Luckily, VS Code supports this by using remote containers and working fully within these containers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Files<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">.devcontainer\\devcontainer.json<\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n\t\"name\": \"Prolog Environment\",\n\n\t\"dockerComposeFile\": [\n\t\t\"docker-compose.yml\"\n\t],\n\n\t\"service\": \"app\",\n\t\"workspaceFolder\": \"\/workspace\",\n\n\t\"settings\": {},\n\t\"extensions\": []\n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">.devcontainer\\docker-compose.yml<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">version: '3.8'\nservices:\n  app:\n    \n    build:\n        context: .\n        dockerfile: Dockerfile\n\n    container_name: pws_prolog\n\n    volumes:\n        - ..\/workspace:\/workspace:cached\n\n    # Overrides default command so things don't shut down after the process ends.\n    command: \/bin\/sh -c \"while sleep 1000; do :; done\"\n <\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">.devcontainer\\Dockerfile<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"dockerfile\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#------------------------------------------------------------------------------\n# STAGE 1:\n#------------------------------------------------------------------------------\nFROM ubuntu:latest as base_nodejs\n\n# Configure Timezone\nENV TZ 'Europe\/Berlin'\n\nRUN echo $TZ > \/etc\/timezone \n\nRUN    apt-get update \\\n    &amp;&amp; apt-get install -y tzdata \\\n    &amp;&amp; rm \/etc\/localtime \\\n    &amp;&amp; ln -snf \/usr\/share\/zoneinfo\/$TZ \/etc\/localtime \\\n    &amp;&amp; dpkg-reconfigure -f noninteractive tzdata \\\n    &amp;&amp; apt-get clean\n\n#\nRUN apt-get install --yes build-essential curl sudo git vim\n\n# Create user\nRUN    groupadd work -g 1000 \\\n    &amp;&amp; adduser user --uid 1000 --gid 1000 --home \/workspace --disabled-password --gecos User\n\n# Setup sudo\nRUN echo '\n\n# Install Prolog\nRUN  apt-get -y install swi-prolog\n\n#\nUSER user\n\nVOLUME [ \"\/workspace\" ]\nWORKDIR \/workspace\n\nCMD [\"\/bin\/bash\"]\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">The Explanation<\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Working with different software (samples, compilers, demos) always requires an adequate environment. Because i don&#8217;t want to pollute my normal environment (my running PC), i decided to use a virtual environment with Docker. Luckily, VS Code supports this by using remote containers and working fully within these containers. The Files .devcontainer\\devcontainer.json .devcontainer\\docker-compose.yml .devcontainer\\Dockerfile The Explanation<\/p>\n","protected":false},"author":1,"featured_media":9077,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[135,102],"tags":[133,134],"class_list":["post-8848","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-daily","category-power-shell","tag-daily","tag-powershell"],"jetpack_featured_media_url":"https:\/\/via-internet.de\/blog\/wp-content\/uploads\/2022\/05\/Header-Daily-Development-Environment.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/posts\/8848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/comments?post=8848"}],"version-history":[{"count":3,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/posts\/8848\/revisions"}],"predecessor-version":[{"id":8851,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/posts\/8848\/revisions\/8851"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/media\/9077"}],"wp:attachment":[{"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/media?parent=8848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/categories?post=8848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/via-internet.de\/blog\/wp-json\/wp\/v2\/tags?post=8848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}