forked from kedacore/keda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add devcontainer * Add docs on launching with vscode dev container
- Loading branch information
1 parent
99b674c
commit 971891b
Showing
3 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#------------------------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. | ||
#------------------------------------------------------------------------------------------------------------- | ||
|
||
FROM golang:1.13-stretch | ||
|
||
# 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 \ | ||
# | ||
# Install gocode-gomod | ||
&& go get -x -d github.com/stamblerre/gocode 2>&1 \ | ||
&& go build -o gocode-gomod github.com/stamblerre/gocode \ | ||
&& mv gocode-gomod $GOPATH/bin/ \ | ||
# | ||
# Install Go tools | ||
&& go get -u -v \ | ||
github.com/mdempsky/gocode \ | ||
github.com/uudashr/gopkgs/cmd/gopkgs \ | ||
github.com/ramya-rao-a/go-outline \ | ||
github.com/acroca/go-symbols \ | ||
github.com/godoctor/godoctor \ | ||
golang.org/x/tools/cmd/guru \ | ||
golang.org/x/tools/cmd/gorename \ | ||
github.com/rogpeppe/godef \ | ||
github.com/zmb3/gogetdoc \ | ||
github.com/haya14busa/goplay/cmd/goplay \ | ||
github.com/sqs/goreturns \ | ||
github.com/josharian/impl \ | ||
github.com/davidrjenni/reftools/cmd/fillstruct \ | ||
github.com/fatih/gomodifytags \ | ||
github.com/cweill/gotests/... \ | ||
golang.org/x/tools/cmd/goimports \ | ||
golang.org/x/lint/golint \ | ||
golang.org/x/tools/cmd/gopls \ | ||
github.com/alecthomas/gometalinter \ | ||
honnef.co/go/tools/... \ | ||
github.com/golangci/golangci-lint/cmd/golangci-lint \ | ||
github.com/mgechev/revive \ | ||
github.com/derekparker/delve/cmd/dlv 2>&1 \ | ||
# | ||
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user. | ||
&& groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
# [Optional] Add sudo support | ||
&& apt-get install -y sudo \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME \ | ||
# Docker install | ||
&& apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common lsb-release \ | ||
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null \ | ||
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \ | ||
&& apt-get update \ | ||
&& apt-get install -y docker-ce-cli \ | ||
# | ||
# Clean up | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Enable go modules | ||
ENV GO111MODULE=on | ||
|
||
ENV OPERATOR_RELEASE_VERSION=v0.12.0 | ||
RUN curl -LO https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_RELEASE_VERSION}/operator-sdk-${OPERATOR_RELEASE_VERSION}-x86_64-linux-gnu \ | ||
&& chmod +x operator-sdk-${OPERATOR_RELEASE_VERSION}-x86_64-linux-gnu \ | ||
&& mkdir -p /usr/local/bin/ \ | ||
&& cp operator-sdk-${OPERATOR_RELEASE_VERSION}-x86_64-linux-gnu /usr/local/bin/operator-sdk \ | ||
&& rm operator-sdk-${OPERATOR_RELEASE_VERSION}-x86_64-linux-gnu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// 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": "Go", | ||
"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", | ||
|
||
// Mount go mod cache | ||
"-v", "keda-gomodcache:/go/pkg", | ||
// Cache vscode exentsions installs and homedir | ||
"-v", "keda-vscodecache:/root/.vscode-server", | ||
|
||
// Mount docker socket for docker 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", | ||
"go.gopath": "/go" | ||
}, | ||
|
||
// Add the IDs of extensions you want installed when the container is created in the array below. | ||
"extensions": [ | ||
"ms-vscode.go" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,30 @@ Meeting time: Weekly Thurs 17:00 UTC. [Convert to your timezone](https://www.the | |
Zoom link: [https://zoom.us/j/150360492 ](https://zoom.us/j/150360492 ) | ||
Meeting agenda: [https://hackmd.io/s/r127ErYiN](https://hackmd.io/s/r127ErYiN) | ||
|
||
## Building: Quick start with [Visual Studio Code Remote - Containers](https://code.visualstudio.com/docs/remote/containers) | ||
|
||
This helps you pull and build quickly - dev containers launch the project inside a container with all the tooling required for a consistent and seamless developer experience. | ||
|
||
This means you don't have to install and configure your dev environment as the container handles this for you. | ||
|
||
To get started install [VSCode](https://code.visualstudio.com/) and the [Remote Containers extensions](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) | ||
|
||
Clone the repo and launch code: | ||
|
||
```bash | ||
git clone [email protected]:kedacore/keda.git | ||
cd keda | ||
code . | ||
``` | ||
|
||
Once VSCode launches run `CTRL+SHIFT+P -> Remote-Containers: Reopen in container` and then use the integrated terminal to run: | ||
|
||
```bash | ||
make build | ||
``` | ||
|
||
> Note: The first time you run the container it will take some time to build and install the tooling. The image will be cached so this is only required the first time. | ||
## Building | ||
This project is using [Operator SDK framework](https://github.com/operator-framework/operator-sdk) v0.11.0. | ||
|
||
|