-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,112 additions
and
81 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
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
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
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
This file was deleted.
Oops, something went wrong.
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,37 @@ | ||
FROM golang:1.19.3-alpine AS builder | ||
|
||
RUN apk add --update --no-cache gcc g++ git | ||
|
||
ARG VERSION | ||
ARG BUILD_TIMESTAMP | ||
ARG COMMIT_HASH | ||
|
||
# Copy runtime_scan go.mod & go.sum | ||
WORKDIR /build/runtime_scan | ||
COPY runtime_scan/go.* ./ | ||
RUN go mod download | ||
|
||
# Copy runtime_scan code | ||
WORKDIR /build | ||
COPY runtime_scan ./runtime_scan | ||
|
||
# Copy backend go.mod & go.sum | ||
WORKDIR /build/backend | ||
COPY backend/go.* ./ | ||
RUN go mod download | ||
|
||
# Copy and build backend code | ||
WORKDIR /build/backend | ||
COPY backend . | ||
RUN go build -ldflags="-s -w \ | ||
-X 'github.com/openclarity/vmclarity/backend/pkg/version.Version=${VERSION}' \ | ||
-X 'github.com/openclarity/vmclarity/backend/pkg/version.CommitHash=${COMMIT_HASH}' \ | ||
-X 'github.com/openclarity/vmclarity/backend/pkg/version.BuildTimestamp=${BUILD_TIMESTAMP}'" -o backend ./cmd/backend/main.go | ||
|
||
FROM alpine:3.16 | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder ["/build/backend/backend", "./backend"] | ||
|
||
ENTRYPOINT ["/app/backend"] |
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
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,80 @@ | ||
// Copyright © 2022 Cisco Systems, Inc. and its affiliates. | ||
// All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
logutils "github.com/Portshift/go-utils/log" | ||
log "github.com/sirupsen/logrus" | ||
"github.com/spf13/viper" | ||
"github.com/urfave/cli" | ||
|
||
"github.com/openclarity/vmclarity/backend/pkg/backend" | ||
"github.com/openclarity/vmclarity/backend/pkg/config" | ||
"github.com/openclarity/vmclarity/backend/pkg/version" | ||
) | ||
|
||
func run(c *cli.Context) { | ||
logutils.InitLogs(c, os.Stdout) | ||
backend.Run() | ||
} | ||
|
||
func versionCommand(_ *cli.Context) { | ||
fmt.Printf("Version: %s \nCommit: %s\nBuild Time: %s", | ||
version.Version, version.CommitHash, version.BuildTimestamp) | ||
} | ||
|
||
func main() { | ||
viper.SetDefault(config.HealthCheckAddress, ":8081") | ||
viper.SetDefault(config.BackendRestPort, "8080") | ||
viper.AutomaticEnv() | ||
app := cli.NewApp() | ||
app.Usage = "" | ||
app.Name = "VMClarity" | ||
app.Version = version.Version | ||
|
||
runCommand := cli.Command{ | ||
Name: "run", | ||
Usage: "Starts VMClarity", | ||
Action: run, | ||
Flags: []cli.Flag{ | ||
cli.StringFlag{ | ||
Name: logutils.LogLevelFlag, | ||
Value: logutils.LogLevelDefaultValue, | ||
Usage: logutils.LogLevelFlagUsage, | ||
}, | ||
}, | ||
} | ||
runCommand.UsageText = runCommand.Name | ||
|
||
versionCommand := cli.Command{ | ||
Name: "version", | ||
Usage: "VMClarity Version Details", | ||
Action: versionCommand, | ||
} | ||
versionCommand.UsageText = versionCommand.Name | ||
|
||
app.Commands = []cli.Command{ | ||
runCommand, | ||
versionCommand, | ||
} | ||
|
||
if err := app.Run(os.Args); err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
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,52 @@ | ||
module github.com/openclarity/vmclarity/backend | ||
|
||
go 1.19 | ||
|
||
require ( | ||
github.com/Portshift/go-utils v0.0.0-20220421083203-89265d8a6487 | ||
github.com/openclarity/vmclarity/runtime_scan v0.0.0 | ||
github.com/sirupsen/logrus v1.9.0 | ||
github.com/spf13/viper v1.14.0 | ||
github.com/urfave/cli v1.22.10 | ||
) | ||
|
||
require ( | ||
github.com/aws/aws-sdk-go-v2 v1.17.1 // indirect | ||
github.com/aws/aws-sdk-go-v2/config v1.17.10 // indirect | ||
github.com/aws/aws-sdk-go-v2/credentials v1.12.23 // indirect | ||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19 // indirect | ||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25 // indirect | ||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19 // indirect | ||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26 // indirect | ||
github.com/aws/aws-sdk-go-v2/service/ec2 v1.66.0 // indirect | ||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19 // indirect | ||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.25 // indirect | ||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8 // indirect | ||
github.com/aws/aws-sdk-go-v2/service/sts v1.17.1 // indirect | ||
github.com/aws/smithy-go v1.13.4 // indirect | ||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect | ||
github.com/fsnotify/fsnotify v1.6.0 // indirect | ||
github.com/hashicorp/hcl v1.0.0 // indirect | ||
github.com/jmespath/go-jmespath v0.4.0 // indirect | ||
github.com/magiconair/properties v1.8.6 // indirect | ||
github.com/mitchellh/mapstructure v1.5.0 // indirect | ||
github.com/pelletier/go-toml v1.9.5 // indirect | ||
github.com/pelletier/go-toml/v2 v2.0.5 // indirect | ||
github.com/russross/blackfriday/v2 v2.0.1 // indirect | ||
github.com/satori/go.uuid v1.2.0 // indirect | ||
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect | ||
github.com/spf13/afero v1.9.2 // indirect | ||
github.com/spf13/cast v1.5.0 // indirect | ||
github.com/spf13/jwalterweatherman v1.1.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/subosito/gotenv v1.4.1 // indirect | ||
golang.org/x/sys v0.0.0-20220908164124-27713097b956 // indirect | ||
golang.org/x/text v0.4.0 // indirect | ||
google.golang.org/grpc v1.50.1 // indirect | ||
gopkg.in/ini.v1 v1.67.0 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) | ||
|
||
// nolint:gomoddirectives | ||
replace github.com/openclarity/vmclarity/runtime_scan v0.0.0 => ./../runtime_scan |
Oops, something went wrong.