feat: add dev-container (#784)

This commit is contained in:
Jorge Turrado Ferrero 2022-06-15 07:11:07 +02:00 committed by GitHub
parent 83b96de1f1
commit e91ad74ac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 71 additions and 0 deletions

37
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,37 @@
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
FROM node:18.3.0-slim
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux,
# this user's GID/UID must match your local user UID/GID to avoid permission issues
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See
# https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Configure apt, install packages and tools
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install git iproute2 procps lsb-release
# [Optional] Add sudo support
RUN apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
#
# deps
RUN apt-get install -y make curl
#
# Clean up
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

View File

@ -0,0 +1,30 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/go
{
"name": "Npm",
"dockerFile": "Dockerfile",
"runArgs": [
// Uncomment the next line to use a non-root user. On Linux, this will prevent
// new files getting created as root, but you may need to update the USER_UID
// and USER_GID in .devcontainer/Dockerfile to match your user if not 1000.
// "-u", "vscode",
// Cache vscode exentsions installs and homedir
"-v", "keda-docs-vscodecache:/root/.vscode-server",
// Mount docker socket for doecker builds
"-v", "/var/run/docker.sock:/var/run/docker.sock",
"--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"
],
// Use 'settings' to set *default* container specific settings.json values on container create.
// You can edit these settings after create using File > Preferences > Settings > Remote.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
},
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
]
}

4
.gitattributes vendored Normal file
View File

@ -0,0 +1,4 @@
# normalize all introduced text files to LF line endings (recognized by git)
* text=auto
# additionally declare text file types
*.sh text eol=lf