mirror of
https://github.com/hanzoai/core-networkmanagement.git
synced 2026-09-30 20:56:28 +00:00
adding updated devcontainer that includes a test DB
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
#-------------------------------------------------------------------------------------------------------------
|
||||
# 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:latest
|
||||
|
||||
# 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 unzip \
|
||||
#
|
||||
# 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 \
|
||||
#
|
||||
# Clean up
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/* /go/src
|
||||
# Install protobuf binary
|
||||
RUN wget -O /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.11.1/protoc-3.11.1-linux-x86_64.zip \
|
||||
&& unzip /tmp/protoc.zip -d /tmp/ \
|
||||
&& mv /tmp/bin/protoc /usr/local/bin/protoc \
|
||||
&& mv /tmp/include /usr/local/include \
|
||||
&& chmod +x /usr/local/bin/protoc \
|
||||
&& go get -u -v \
|
||||
github.com/golang/protobuf/protoc-gen-go \
|
||||
github.com/golang/protobuf/proto \
|
||||
github.com/miekg/dns \
|
||||
google.golang.org/grpc 2>&1
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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",
|
||||
"dockerComposeFile":["docker-compose.yaml"],
|
||||
"service": "golang",
|
||||
"workspaceFolder": "/go/src/core-networkmanager",
|
||||
"shutdownAction": "stopCompose",
|
||||
"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",
|
||||
|
||||
"--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"
|
||||
},
|
||||
|
||||
// Uncomment the next line if you want to publish any ports.
|
||||
//"appPort": [8080],
|
||||
|
||||
// Uncomment the next line to run commands after the container is created.
|
||||
//"postCreateCommand": "echo ${workspaceFolderBasename}",
|
||||
|
||||
// Add the IDs of extensions you want installed when the container is created in the array below.
|
||||
"extensions": [
|
||||
"ms-vscode.go",
|
||||
"casualjim.gotemplate"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
golang:
|
||||
build: .
|
||||
volumes:
|
||||
- ../:/go/src/core-networkmanager
|
||||
ports:
|
||||
- "8080:8080"
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
command: sleep infinity
|
||||
roach:
|
||||
image: cockroachdb/cockroach:v19.2.2
|
||||
hostname: roach
|
||||
command: start-single-node --insecure
|
||||
ports:
|
||||
- "26257:26257"
|
||||
- "8081:8080"
|
||||
volumes:
|
||||
- data:/cockroach/cockroach-data
|
||||
|
||||
volumes:
|
||||
data:
|
||||
@@ -0,0 +1,24 @@
|
||||
.nav > ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
.nav > li {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.nav > li a {
|
||||
display: block;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding: 14px 16px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Change the link color to #111 (black) on hover */
|
||||
.nav > li a:hover {
|
||||
background-color:#111;
|
||||
}
|
||||
Vendored
+3
-92
@@ -7,7 +7,6 @@
|
||||
* 12/29/2014
|
||||
*/
|
||||
|
||||
|
||||
/* Table of contents
|
||||
––––––––––––––––––––––––––––––––––––––––––––––––––
|
||||
- Grid
|
||||
@@ -23,95 +22,7 @@
|
||||
- Utilities
|
||||
- Clearing
|
||||
- Media Queries
|
||||
*/
|
||||
|
||||
|
||||
/* Grid
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px;
|
||||
box-sizing: border-box; }
|
||||
.column,
|
||||
.columns {
|
||||
width: 100%;
|
||||
float: left;
|
||||
box-sizing: border-box; }
|
||||
|
||||
/* For devices larger than 400px */
|
||||
@media (min-width: 400px) {
|
||||
.container {
|
||||
width: 85%;
|
||||
padding: 0; }
|
||||
}
|
||||
|
||||
/* For devices larger than 550px */
|
||||
@media (min-width: 550px) {
|
||||
.container {
|
||||
width: 80%; }
|
||||
.column,
|
||||
.columns {
|
||||
margin-left: 4%; }
|
||||
.column:first-child,
|
||||
.columns:first-child {
|
||||
margin-left: 0; }
|
||||
|
||||
.one.column,
|
||||
.one.columns { width: 4.66666666667%; }
|
||||
.two.columns { width: 13.3333333333%; }
|
||||
.three.columns { width: 22%; }
|
||||
.four.columns { width: 30.6666666667%; }
|
||||
.five.columns { width: 39.3333333333%; }
|
||||
.six.columns { width: 48%; }
|
||||
.seven.columns { width: 56.6666666667%; }
|
||||
.eight.columns { width: 65.3333333333%; }
|
||||
.nine.columns { width: 74.0%; }
|
||||
.ten.columns { width: 82.6666666667%; }
|
||||
.eleven.columns { width: 91.3333333333%; }
|
||||
.twelve.columns { width: 100%; margin-left: 0; }
|
||||
|
||||
.one-third.column { width: 30.6666666667%; }
|
||||
.two-thirds.column { width: 65.3333333333%; }
|
||||
|
||||
.one-half.column { width: 48%; }
|
||||
|
||||
/* Offsets */
|
||||
.offset-by-one.column,
|
||||
.offset-by-one.columns { margin-left: 8.66666666667%; }
|
||||
.offset-by-two.column,
|
||||
.offset-by-two.columns { margin-left: 17.3333333333%; }
|
||||
.offset-by-three.column,
|
||||
.offset-by-three.columns { margin-left: 26%; }
|
||||
.offset-by-four.column,
|
||||
.offset-by-four.columns { margin-left: 34.6666666667%; }
|
||||
.offset-by-five.column,
|
||||
.offset-by-five.columns { margin-left: 43.3333333333%; }
|
||||
.offset-by-six.column,
|
||||
.offset-by-six.columns { margin-left: 52%; }
|
||||
.offset-by-seven.column,
|
||||
.offset-by-seven.columns { margin-left: 60.6666666667%; }
|
||||
.offset-by-eight.column,
|
||||
.offset-by-eight.columns { margin-left: 69.3333333333%; }
|
||||
.offset-by-nine.column,
|
||||
.offset-by-nine.columns { margin-left: 78.0%; }
|
||||
.offset-by-ten.column,
|
||||
.offset-by-ten.columns { margin-left: 86.6666666667%; }
|
||||
.offset-by-eleven.column,
|
||||
.offset-by-eleven.columns { margin-left: 95.3333333333%; }
|
||||
|
||||
.offset-by-one-third.column,
|
||||
.offset-by-one-third.columns { margin-left: 34.6666666667%; }
|
||||
.offset-by-two-thirds.column,
|
||||
.offset-by-two-thirds.columns { margin-left: 69.3333333333%; }
|
||||
|
||||
.offset-by-one-half.column,
|
||||
.offset-by-one-half.columns { margin-left: 52%; }
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/* Base Styles
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
@@ -287,7 +198,7 @@ label > .label-body {
|
||||
|
||||
/* Lists
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
ul {
|
||||
/*ul {
|
||||
list-style: circle inside; }
|
||||
ol {
|
||||
list-style: decimal inside; }
|
||||
@@ -302,7 +213,7 @@ ol ul {
|
||||
font-size: 90%; }
|
||||
li {
|
||||
margin-bottom: 1rem; }
|
||||
|
||||
*/
|
||||
|
||||
/* Code
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– */
|
||||
|
||||
+30
-36
@@ -1,46 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
<!-- Basic Page Needs
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<meta charset="utf-8">
|
||||
<title>Your page title here :)</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
li {
|
||||
float: left;
|
||||
}
|
||||
|
||||
<!-- Mobile Specific Metas
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- FONT
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- CSS
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link rel="stylesheet" href="css/normalize.css">
|
||||
<link rel="stylesheet" href="css/skeleton.css">
|
||||
|
||||
<!-- Favicon
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link rel="icon" type="image/png" href="images/favicon.png">
|
||||
li a {
|
||||
display: block;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding: 14px 16px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
li a:hover {
|
||||
background-color: #111;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Primary Page Layout
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="one-half column" style="margin-top: 25%">
|
||||
<h4>Basic Page</h4>
|
||||
<p>This index.html page is a placeholder with the CSS, font and favicon. It's just waiting for you to add some content! If you need some help hit up the <a href="http://www.getskeleton.com">Skeleton documentation</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a class="active" href="#home">Home</a></li>
|
||||
<li><a href="#news">News</a></li>
|
||||
<li><a href="#contact">Contact</a></li>
|
||||
<li><a href="#about">About</a></li>
|
||||
</ul>
|
||||
|
||||
<!-- End Document
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
+9
-8
@@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
"strconv"
|
||||
"html/template"
|
||||
"github.com/lib/pq"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -29,15 +30,15 @@ type Page struct {
|
||||
|
||||
func homePage(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == "GET" {
|
||||
t, _ := template.ParseFiles("index.gohtml")
|
||||
home := Page{Location: "/", Name: "Home"}
|
||||
data := struct {
|
||||
Pages []*Page
|
||||
} {
|
||||
Pages: []*Page{ &home },
|
||||
t, err := template.ParseFiles("index.gohtml")
|
||||
if err != nil {
|
||||
log.Fatal("Parse failed: ", err)
|
||||
}
|
||||
if err := t.Execute(w, data); err != nil {
|
||||
println("parse failed with error", err)
|
||||
home := Page{Location: "/", Name: "Home"}
|
||||
search := Page{Location: "/search", Name: "Search"}
|
||||
data := struct { Pages []*Page }{ []*Page{ &home, &search } }
|
||||
if err := t.ExecuteTemplate(w, "index", data); err != nil {
|
||||
log.Fatal("ExecuteTemplate failed:", err)
|
||||
}
|
||||
} else {
|
||||
r.ParseForm()
|
||||
|
||||
Reference in New Issue
Block a user