mirror of
https://github.com/dragonheim/gagent.git
synced 2025-04-12 00:22:40 -07:00
feat: Converting to semantic versioning and add .devcontainer.
This commit is contained in:
parent
f7d62890dd
commit
7e805a399e
4 changed files with 62 additions and 12 deletions
42
.devcontainer/devcontainer.json
Normal file
42
.devcontainer/devcontainer.json
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{
|
||||||
|
"name": "GitHub Codespaces (Default)",
|
||||||
|
"build": {
|
||||||
|
"dockerfile": "Dockerfile"
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"go.toolsManagement.checkForUpdates": "local",
|
||||||
|
"go.useLanguageServer": true,
|
||||||
|
"go.gopath": "/go",
|
||||||
|
"go.goroot": "/usr/local/go",
|
||||||
|
"go.linting.enabled": true,
|
||||||
|
"lldb.executable": "/usr/bin/lldb",
|
||||||
|
"files.watcherExclude": {
|
||||||
|
"**/target/**": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"remoteUser": "codespace",
|
||||||
|
"overrideCommand": false,
|
||||||
|
"mounts": ["source=codespaces-linux-var-lib-docker,target=/var/lib/docker,type=volume"],
|
||||||
|
"runArgs": [
|
||||||
|
"--cap-add=SYS_PTRACE",
|
||||||
|
"--security-opt",
|
||||||
|
"seccomp=unconfined",
|
||||||
|
"--privileged",
|
||||||
|
"--init"
|
||||||
|
],
|
||||||
|
|
||||||
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
|
"extensions": [
|
||||||
|
"GitHub.vscode-pull-request-github",
|
||||||
|
"golang.go",
|
||||||
|
"hashicorp.terraform",
|
||||||
|
"wholroyd.hcl",
|
||||||
|
"github.copilot"
|
||||||
|
],
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// "oryx build" will automatically install your dependencies and attempt to build your project
|
||||||
|
// "postCreateCommand": "oryx build -p virtualenv_name=.venv --log-file /tmp/oryx-build.log --manifest-dir /tmp || echo 'Could not auto-build. Skipping.'"
|
||||||
|
}
|
|
@ -50,10 +50,10 @@ steps:
|
||||||
- trivy fs --exit-code 0 --severity UNKNOWN,LOW,MEDIUM .
|
- trivy fs --exit-code 0 --severity UNKNOWN,LOW,MEDIUM .
|
||||||
|
|
||||||
# Perform code security check of higher level vulnerabilities. This can break the build.
|
# Perform code security check of higher level vulnerabilities. This can break the build.
|
||||||
# - trivy fs --skip-update --exit-code 1 --severity CRITICAL,HIGH .
|
- trivy fs --skip-update --exit-code 1 --severity CRITICAL,HIGH .
|
||||||
|
|
||||||
# Build new container image.
|
# Build new container image.
|
||||||
# - docker buildx build --push --platform linux/amd64 --progress plain -t ${DRONE_REPO}:${DRONE_COMMIT} -f docker/Dockerfile .
|
# - docker buildx build --push --platform linux/amd64 --progress plain --build-arg SEMVER="${DRONE_SEMVER:0.0.3}" -t ${DRONE_REPO}:${DRONE_COMMIT} -f docker/Dockerfile .
|
||||||
|
|
||||||
# Perform image security check of lower level vulnerabilities. This will not break the build, we just want this information, just in case.
|
# Perform image security check of lower level vulnerabilities. This will not break the build, we just want this information, just in case.
|
||||||
# - trivy image --skip-update --exit-code 0 --severity UNKNOWN,LOW,MEDIUM,HIGH ${DRONE_REPO}:${DRONE_COMMIT}
|
# - trivy image --skip-update --exit-code 0 --severity UNKNOWN,LOW,MEDIUM,HIGH ${DRONE_REPO}:${DRONE_COMMIT}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
FROM golang:1.17-alpine3.14 as builder
|
# FROM golang:1.17-alpine3.14 as builder
|
||||||
|
FROM dragonheim/golang:1.17.0 as builder
|
||||||
|
ARG SEMVER
|
||||||
|
|
||||||
WORKDIR /gagent
|
WORKDIR /gagent
|
||||||
COPY . .
|
COPY . .
|
||||||
|
@ -8,13 +10,15 @@ ARG GOOS=${GOOS:-linux}
|
||||||
ARG CGO_ENABLED=1
|
ARG CGO_ENABLED=1
|
||||||
|
|
||||||
RUN apk add --no-cache zeromq-dev build-base git
|
RUN apk add --no-cache zeromq-dev build-base git
|
||||||
RUN go build -o /gagent/bin/gagent gagent/main.go
|
RUN go build -o /gagent/bin/gagent -ldflags "-X main.semVER=${SEMVER}" gagent/main.go
|
||||||
RUN strip /gagent/bin/gagent
|
RUN strip /gagent/bin/gagent
|
||||||
|
|
||||||
FROM alpine:3.14
|
FROM alpine:3.14
|
||||||
|
ARG vernum
|
||||||
LABEL Name="G'Agent"
|
LABEL Name="G'Agent"
|
||||||
LABEL Maintainer="jwells@dragonheim.net"
|
LABEL Maintainer="jwells@dragonheim.net"
|
||||||
LABEL License="MIT License"
|
LABEL License="MIT License"
|
||||||
|
LABEL version="${SEMVER}"
|
||||||
RUN apk add --no-cache zeromq && mkdir -p -m 0700 /etc/gagent
|
RUN apk add --no-cache zeromq && mkdir -p -m 0700 /etc/gagent
|
||||||
|
|
||||||
COPY --from=builder /gagent/examples/gagent.hcl /etc/gagent/gagent.hcl
|
COPY --from=builder /gagent/examples/gagent.hcl /etc/gagent/gagent.hcl
|
||||||
|
@ -25,3 +29,5 @@ EXPOSE 35570/tcp 35571/tcp 35572/tcp
|
||||||
VOLUME /etc/gagent
|
VOLUME /etc/gagent
|
||||||
|
|
||||||
CMD ["/usr/bin/gagent"]
|
CMD ["/usr/bin/gagent"]
|
||||||
|
|
||||||
|
HEALTHCHECK NONE
|
||||||
|
|
|
@ -20,7 +20,9 @@ import (
|
||||||
cty "github.com/zclconf/go-cty/cty"
|
cty "github.com/zclconf/go-cty/cty"
|
||||||
)
|
)
|
||||||
|
|
||||||
const versionNum = "0.0.1"
|
var (
|
||||||
|
semVER = "0.0.2"
|
||||||
|
)
|
||||||
|
|
||||||
var exitCodes = struct {
|
var exitCodes = struct {
|
||||||
m map[string]int
|
m map[string]int
|
||||||
|
@ -106,15 +108,15 @@ func main() {
|
||||||
usage += "\n"
|
usage += "\n"
|
||||||
|
|
||||||
usage += "Arguments: \n"
|
usage += "Arguments: \n"
|
||||||
usage += " client -- Start as a G'Agent client \n"
|
usage += " client -- Start as a G'Agent client \n"
|
||||||
usage += " router -- Start as a G'Agent router \n"
|
usage += " router -- Start as a G'Agent router \n"
|
||||||
usage += " worker -- Start as a G'Agent worker \n"
|
usage += " worker -- Start as a G'Agent worker \n"
|
||||||
usage += " setup -- Write initial configuration file \n"
|
usage += " setup -- Write initial configuration file \n"
|
||||||
usage += "\n"
|
usage += "\n"
|
||||||
|
|
||||||
usage += "Options:\n"
|
usage += "Options:\n"
|
||||||
usage += " -h --help -- Show this help screen \n"
|
usage += " -h --help -- Show this help screen and exit \n"
|
||||||
usage += " --version -- Show version \n"
|
usage += " --version -- Show version and exit \n"
|
||||||
usage += " --config=<config> -- [default: /etc/gagent/gagent.hcl] \n"
|
usage += " --config=<config> -- [default: /etc/gagent/gagent.hcl] \n"
|
||||||
usage += " --agent=<file> -- filename of the agent to be uploaded to the G'Agent network \n"
|
usage += " --agent=<file> -- filename of the agent to be uploaded to the G'Agent network \n"
|
||||||
|
|
||||||
|
@ -122,7 +124,7 @@ func main() {
|
||||||
* Consume the usage variable and the command line arguments to create a
|
* Consume the usage variable and the command line arguments to create a
|
||||||
* dictionary / map.
|
* dictionary / map.
|
||||||
*/
|
*/
|
||||||
opts, _ := docopt.ParseArgs(usage, nil, versionNum)
|
opts, _ := docopt.ParseArgs(usage, nil, semVER)
|
||||||
log.Printf("[DEBUG] Arguments are %v\n", opts)
|
log.Printf("[DEBUG] Arguments are %v\n", opts)
|
||||||
|
|
||||||
if opts["--config"] != nil {
|
if opts["--config"] != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue