Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
Added Dev Container / Updated Contributor Doc (#299)
Browse files Browse the repository at this point in the history
* added basic dev container

* added docker-lock

* Added helm

* updated contributing instructions

* fixed spacing

Co-authored-by: Michael Perel <[email protected]>
Co-authored-by: Evan Louie <[email protected]>
  • Loading branch information
3 people authored Apr 29, 2020
1 parent e8a80bc commit 2b389c9
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 36 deletions.
27 changes: 27 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM ubuntu:bionic

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG GO_VERSION=1.14.2
ARG GOLANGCI_LINT_VERSION=1.25.0
ARG HELM_VERSION=3.1.2
ARG DOCKER_VERSION=19.03.8
ARG DOCKER_LOCK_VERSION=0.2.0

RUN apt-get update && \
apt-get -y install vim curl wget gcc software-properties-common && \
add-apt-repository ppa:git-core/ppa -y && \
apt-get update && \
apt-get install git -y && \
curl -fsSL "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" | tar -xz && \
mv linux-amd64/helm /usr/local/bin && \
rm -rf linux-amd64 && \
curl -fsSL "https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz" | tar -xz -C /usr/local docker/docker && \
mkdir -p "${HOME}/.docker/cli-plugins" && \
curl -fsSL "https://github.com/michaelperel/docker-lock/releases/download/v${DOCKER_LOCK_VERSION}/docker-lock-linux" -o "${HOME}/.docker/cli-plugins/docker-lock" && \
chmod +x "${HOME}/.docker/cli-plugins/docker-lock" && \
curl -fsSL "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" | tar -xz -C /usr/local && \
curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b "${HOME}/go/bin" "v${GOLANGCI_LINT_VERSION}" && \
echo "export PATH=/usr/local/go/bin:${HOME}/go/bin:/usr/local/docker:${PATH}" >> "${HOME}/.bashrc" && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
47 changes: 47 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// 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/docker-existing-dockerfile
{
"name": "Dev Dockerfile",
"dockerFile": "Dockerfile",
// The optional 'runArgs' property can be used to specify additional runtime arguments.
"runArgs": [
// Enable go debugger
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined",
// map host docker daemon into container for sibling containers
"-v",
"/var/run/docker.sock:/var/run/docker.sock"
],
"settings": {
"files.eol": "\n",
"terminal.integrated.shell.linux": "/bin/bash",
// Go recommended settings with modules: https://github.com/golang/tools/blob/master/gopls/doc/vscode.md#vscode
"go.useLanguageServer": true,
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--fast"
],
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
// Optional: Disable snippets, as they conflict with completion ranking.
"editor.snippetSuggestions": "none"
},
"[go.mod]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"gopls": {
// Add parameter placeholders when completing a function.
"usePlaceholders": true
}
},
"extensions": [
"ms-vscode.go"
]
}
12 changes: 12 additions & 0 deletions .devcontainer/docker-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"dockerfiles": {
"Dockerfile": [
{
"name": "ubuntu",
"tag": "bionic",
"digest": "b58746c8a89938b8c9f5b77de3b8cf1fe78210c696ab03a1442e235eea65d84f"
}
]
},
"composefiles": {}
}
54 changes: 18 additions & 36 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,47 +32,29 @@ intended to solve via "Closes #xyz" where is the issue number that is addressed.

## Cloning Fabrikate

Fabrikate is written in [golang](https://golang.org/) so the first step is to
make sure you have a fully functioning go development enviroment.

If you intend to make contributions to Fabrikate (versus just build it), the
first step is to
[fork Fabrikate on Github](https://github.com/microsoft/fabrikate) into your own
account.

Next, clone Fabrikate into your GOPATH (which defaults to \$HOME/go) with
`go get` (substitute your GitHub username for `microsoft` below if you forked
the repo):

```sh
$ go get github.com/microsoft/fabrikate
```

If you forked Fabrikate, this will clone your fork into
`$GOPATH/<github username>/fabrikate`. You will want to move to
\$GOPATH/microsoft/fabrikate such that the imports in the project work
correctly.

### Configuring git

Under `$GOPATH/microsoft/fabrikate` set up git so that you can push changes to
the fork:

```sh
$ git remote add <name> <github_url_of_fork>
```

For example:

```sh
$ git remote add myremote https://github.com/octocat/Spoon-Knife
```

To push changes to the fork:

```sh
$ git push myremote mycurrentbranch
```
Fabrikate comes with a development container for
[Visual Studio Code](https://code.visualstudio.com/docs/remote/containers).

> Note: If you do not want to use the development container, ensure you have
go version >= 1.12. Fabrikate uses
[go modules](https://github.com/golang/go/wiki/Modules), so either git clone
your fork outside of the `GOPATH` or set `GO111MODULE=on` if you want to work
within the `GOPATH`.

To use the development container:
1. Install Microsoft's
[Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).
2. Git clone your fork of the repo.
3. Open the project in VSCode.
4. In the command palette (`ctrl+shift+p` on Windows/Linux, `command+shift+p` on Mac),
select "Reopen in Container".
5. In the command palette type: "Go: Install/Update Tools" and select all.
6. When all tools are finished installing, in the command palette type: "Developer: Reload Window".

## Building Fabrikate

Expand Down

0 comments on commit 2b389c9

Please sign in to comment.