Skip to content

Commit 6dc31c5

Browse files
committed
wip: added k8 deployment manifests for skaffolding
1 parent ec2ce39 commit 6dc31c5

File tree

4 files changed

+105
-0
lines changed

4 files changed

+105
-0
lines changed

Containerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM golang:1.20 AS builder
2+
3+
WORKDIR /app
4+
5+
COPY go.mod go.sum ./
6+
RUN go mod download
7+
8+
# Copy source code
9+
COPY . .
10+
11+
# Build mercury
12+
RUN go build -o main .
13+
14+
# Use a smaller image for running
15+
FROM alpine:latest
16+
WORKDIR /root/
17+
COPY --from=builder /app/main .
18+
19+
# Expose the web port
20+
EXPOSE 8080
21+
22+
# Run mercury server
23+
CMD ["./main"]

k8s/mercury-deployment.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
namespace: mercury
5+
name: mercury-app
6+
labels:
7+
app: mercury-app
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: mercury-app
13+
template:
14+
metadata:
15+
labels:
16+
app: mercury-app
17+
spec:
18+
containers:
19+
- name: mercury-app
20+
image: mercury-app:latest
21+
ports:
22+
- containerPort: 8080
23+
volumeMounts:
24+
- mountPath: /app
25+
name: mercury-app-code
26+
volumes:
27+
- name: mercury-app-code
28+
emptyDir: {}
29+
---
30+
apiVersion: v1
31+
kind: Service
32+
metadata:
33+
name: mercury-app-service
34+
spec:
35+
selector:
36+
app: mercury-app
37+
ports:
38+
- protocol: TCP
39+
port: 8080
40+
targetPort: 8080

k8s/mongodb-deployment.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: mongodb
5+
labels:
6+
app: mongodb
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: mongodb
12+
template:
13+
metadata:
14+
labels:
15+
app: mongodb
16+
spec:
17+
containers:
18+
- name: mongodb
19+
image: mongo:6.0
20+
ports:
21+
- containerPort: 27017
22+
env:
23+
- name: MONGO_INITDB_ROOT_USERNAME
24+
value: root
25+
- name: MONGO_INITDB_ROOT_PASSWORD
26+
value: example
27+
---
28+
apiVersion: v1
29+
kind: Service
30+
metadata:
31+
name: mongodb-service
32+
spec:
33+
ports:
34+
- port: 27017
35+
targetPort: 27017
36+
selector:
37+
app: mongodb
38+
type: ClusterIP

k8s/namespace.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: mercury

0 commit comments

Comments
 (0)