-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from anchore/delve-debug-build
chore: add dev debug build using delve
- Loading branch information
Showing
4 changed files
with
138 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,20 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug", | ||
"type": "go", | ||
"debugAdapter": "dlv-dap", | ||
"request": "attach", | ||
"mode": "remote", | ||
"port": 2345, | ||
"host": "localhost", | ||
"substitutePath": [ | ||
{ | ||
"from": "${workspaceFolder}", | ||
"to": "/go/src/github.com/anchore/harbor-scanner-adapter" | ||
} | ||
] | ||
} | ||
] | ||
} |
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,17 @@ | ||
########## Builder ########## | ||
FROM golang:1.21-alpine AS builder | ||
|
||
# Install the latest version of Delve | ||
RUN go install github.com/go-delve/delve/cmd/[email protected] | ||
|
||
ENV APP_PATH=/go/src/github.com/anchore/harbor-scanner-adapter | ||
|
||
RUN mkdir -p $APP_PATH | ||
WORKDIR $APP_PATH | ||
COPY . $APP_PATH | ||
|
||
# Expose debugger | ||
EXPOSE 2345 | ||
|
||
# Start Delve | ||
CMD /go/bin/dlv --listen=:2345 --headless --accept-multiclient debug $APP_PATH/cmd/anchore-adapter/main.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
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,81 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: harbor-scanner-anchore | ||
labels: | ||
app: harbor-scanner-anchore | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: harbor-scanner-anchore | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: harbor-scanner-anchore | ||
spec: | ||
containers: | ||
- name: adapter | ||
image: anchore/harbor-scanner-adapter:debug | ||
imagePullPolicy: Never | ||
env: | ||
- name: SCANNER_ADAPTER_LISTEN_ADDR | ||
value: ":8080" | ||
- name: ANCHORE_ENDPOINT | ||
value: "http://host.docker.internal:8228" | ||
- name: ANCHORE_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: anchore-creds | ||
key: username | ||
- name: ANCHORE_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: anchore-creds | ||
key: password | ||
- name: ANCHORE_CLIENT_TIMEOUT_SECONDS | ||
value: "60" | ||
- name: SCANNER_ADAPTER_FILTER_VENDOR_IGNORED | ||
value: "true" | ||
- name: SCANNER_ADAPTER_LOG_LEVEL | ||
value: "debug" | ||
- name: SCANNER_ADAPTER_REGISTRY_TLS_VERIFY | ||
value: "false" | ||
# To enable api authentication, uncomment this and set it to a good randomized value. Use that same value in the scanner config in Harbor UI with "Bearer" type | ||
# - name: "SCANNER_ADAPTER_APIKEY" | ||
# value: "apikey123" | ||
|
||
# Uncomment below to enable https in api | ||
# - name: SCANNER_ADAPTER_TLS_KEY_FILE | ||
# value: "/certs/tls.key" | ||
# - name: SCANNER_ADAPTER_TLS_CERT_FILE | ||
# value: "/certs/tls.crt" | ||
|
||
# volumeMounts: | ||
# - name: certs | ||
# mountPath: /certs | ||
# ports: | ||
# - containerPort: 8080 | ||
# volumes: | ||
# - name: certs | ||
# secret: | ||
# secretName: adapter-certs | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: harbor-scanner-anchore-debug | ||
spec: | ||
selector: | ||
app: harbor-scanner-anchore | ||
type: LoadBalancer | ||
ports: | ||
- protocol: TCP | ||
name: app | ||
port: 8080 | ||
targetPort: 8080 | ||
- protocol: TCP | ||
name: dlv | ||
port: 2345 | ||
targetPort: 2345 |