fix the dockerfile build process (#24)

Co-authored-by: rick <LinuxSuRen@users.noreply.github.com>
This commit is contained in:
Rick 2023-04-04 13:28:18 +08:00 committed by GitHub
parent e2340a20a8
commit d8549db1eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 3 deletions

View File

@ -3,9 +3,7 @@ FROM golang:1.17 as builder
WORKDIR /workspace
COPY . .
RUN go mod download
RUN CGO_ENABLE=0 go build -ldflags "-w -s" -o atest cmd/*.go
FROM ghcr.io/linuxsuren/hd:v0.0.67 as hd
RUN CGO_ENABLE=0 go build -ldflags "-w -s" -o atest .
FROM alpine:3.10

46
sample/manifest.yaml Normal file
View File

@ -0,0 +1,46 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: api-testing
name: api-testing
spec:
replicas: 1
selector:
matchLabels:
app: api-testing
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: api-testing
spec:
containers:
- image: ghcr.io/linuxsuren/api-testing
name: server
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: "100m"
memory: 100m
status: {}
---
apiVersion: v1
kind: Service
metadata:
name: api-testing
spec:
ports:
- name: server
port: 9090
protocol: TCP
targetPort: 9090
selector:
app: api-testing
sessionAffinity: None
type: NodePort