From dcc32847d27319a81188671888a32edc8250d460 Mon Sep 17 00:00:00 2001 From: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com> Date: Sun, 20 Sep 2020 07:52:46 +0000 Subject: [PATCH] Added devcontainer --- .devcontainer/Dockerfile | 15 ++++++++++++++ .devcontainer/devcontainer.json | 34 +++++++++++++++++++++++++++++++ .devcontainer/docker-compose.yaml | 29 ++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.yaml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..3b1fc9c --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,15 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/javascript-node/.devcontainer/base.Dockerfile + +# Based on Node.js 14 +FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-14 + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# [Optional] Uncomment if you want to install an additional version of node using nvm +# ARG EXTRA_NODE_VERSION=10 +# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" + +# [Optional] Uncomment if you want to install more global node modules +# RUN sudo -u node npm install -g diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..87f67dc --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,34 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/javascript-node +{ + "name": "svelte-spa-router", + + "dockerComposeFile": "docker-compose.yaml", + "service": "development", + "workspaceFolder": "/workspace", + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/usr/bin/zsh" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "bierner.markdown-preview-github-styles", + "davidanson.vscode-markdownlint", + "dbaeumer.vscode-eslint", + "eg2.vscode-npm-script", + "svelte.svelte-vscode", + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 5000 + ], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "npm install", + + // Connect as a non-root user + "remoteUser": "node" +} diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml new file mode 100644 index 0000000..9d5fdbd --- /dev/null +++ b/.devcontainer/docker-compose.yaml @@ -0,0 +1,29 @@ +version: '3' + +services: + development: + build: + context: . + dockerfile: Dockerfile + volumes: + # Update this to wherever you want VS Code to mount the folder of your project + - ..:/workspace:cached + # Overrides default command so things don't shut down after the process ends. + command: sleep infinity + # Use a non-root user for all processes. + user: node + environment: + - 'SELENIUM_HOST=selenium-chrome' + - 'SELENIUM_PORT=4444' + - 'LAUNCH_URL=http://nginx' + nginx: + image: nginx:1.19 + container_name: nginx + volumes: + - ../test/app/dist:/usr/share/nginx/html:ro + ports: + - 8080:80 + selenium-chrome: + image: selenium/standalone-chrome:85.0 + container_name: selenium-chrome + shm_size: '2gb'