Skip to content

Commit e5858c7

Browse files
authored
build(gateway): add github workflow (#2)
* build(gateway): add github workflow * build(gateway): update docker repository * ci(gateway): add kubernetes config * ci(gateway): add kubernetes config
1 parent 3bd4a67 commit e5858c7

File tree

7 files changed

+104
-0
lines changed

7 files changed

+104
-0
lines changed

.github/workflows/build.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Docker Build & Publish
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: Build Image
14+
env:
15+
DOCKER_PASSWD: ${{ secrets.DOCKER_PASSWORD }}
16+
run: |
17+
docker login -u theleede -p $DOCKER_PASSWD
18+
docker build -t ryss/gateway-service . -f Dockerfile
19+
docker tag ryss/gateway-service ryss/gateway-service:latest
20+
docker tag ryss/gateway-service ryss/gateway-service:${GITHUB_SHA::8}
21+
- name: Push Image
22+
if: github.ref == 'refs/heads/master'
23+
run: docker push ryss/gateway-service

Chart.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
name: gateway-service
2+
version: 0.1

Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM gradle AS build
2+
COPY --chown=gradle:gradle . /home/gradle/src
3+
WORKDIR /home/gradle/src
4+
RUN gradle clean shadowJar --no-daemon
5+
6+
FROM adoptopenjdk:8-jre-openj9
7+
RUN mkdir /app
8+
COPY --from=build /home/gradle/src/build/libs/*.jar /app/gateway-service.jar
9+
CMD ["java", "-jar", "/app/gateway-service.jar"]

templates/config.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: gateway-config
5+
data:
6+
GATEWAY_SERVICE_INFLUXDB_ADDRESS: ''
7+
GATEWAY_SERVICE_INFLUXDB_TOKEN: ''
8+
GATEWAY_SERVICE_INFLUXDB_ORG: ''
9+
GATEWAY_SERVICE_INFLUXDB_BUCKET: ''
10+
GATEWAY_SERVICE_SENTRY_DSN: ''

templates/deployment.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: gateway-service-deployment
5+
labels:
6+
keel.sh/trigger: poll
7+
keel.sh/match-tag: "true"
8+
keel.sh/policy: "force"
9+
annotations:
10+
keel.sh/pollSchedule: "@every 1m"
11+
spec:
12+
replicas: 3
13+
selector:
14+
matchLabels:
15+
app: gateway-service
16+
strategy:
17+
type: RollingUpdate
18+
rollingUpdate:
19+
maxSurge: 1
20+
maxUnavailable: 25%
21+
template:
22+
metadata:
23+
labels:
24+
app: gateway-service
25+
spec:
26+
containers:
27+
- name: site
28+
image: ryss/gateway-service:latest
29+
envFrom:
30+
- configMapRef:
31+
name: gateway-config
32+
imagePullPolicy: Always
33+
ports:
34+
- containerPort: 3500

templates/ingress.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: traefik.containo.us/v1alpha1
2+
kind: IngressRoute
3+
metadata:
4+
name: gateway-service-ingress
5+
6+
spec:
7+
routes:
8+
- match: Host(`api.ryss.app`)
9+
kind: Rule
10+
services:
11+
- name: gateway-service-service
12+
port: 80

templates/service.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: gateway-service-service
5+
spec:
6+
ports:
7+
- name: tcp
8+
port: 80
9+
protocol: TCP
10+
targetPort: 3500
11+
selector:
12+
app: gateway-service
13+
type: LoadBalancer
14+
loadBalancerIP: 192.168.1.10

0 commit comments

Comments
 (0)