build: add dockerfile and k8s manifests
This commit is contained in:
parent
dd56d52807
commit
c6de46b8dc
13
deploy/Dockerfile
Normal file
13
deploy/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
# Build stage
|
||||
FROM golang:1.24-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY ./ .
|
||||
RUN go build -o metrics-counter .
|
||||
|
||||
# Runtime stage
|
||||
FROM alpine:latest
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/metrics-counter .
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["./metrics-counter"]
|
28
deploy/k8s/deployment.yaml
Normal file
28
deploy/k8s/deployment.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: metrics-counter
|
||||
namespace: metrics-counter
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: metrics-counter
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: metrics-counter
|
||||
spec:
|
||||
containers:
|
||||
- name: metrics-counter
|
||||
image: docker.io/sigthror/metrics-counter:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
resources:
|
||||
requests:
|
||||
memory: "64Mi"
|
||||
cpu: "50m"
|
||||
limits:
|
||||
memory: "128Mi"
|
||||
cpu: "100m"
|
4
deploy/k8s/namespace.yaml
Normal file
4
deploy/k8s/namespace.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: metrics-counter
|
12
deploy/k8s/service.yaml
Normal file
12
deploy/k8s/service.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: metrics-counter
|
||||
namespace: metrics-counter
|
||||
spec:
|
||||
selector:
|
||||
app: metrics-counter
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 8080
|
||||
targetPort: 8080
|
Loading…
x
Reference in New Issue
Block a user