Add github workflow, dockerfile, kubefile, and some scriptsd

This commit is contained in:
root 2021-06-04 10:58:08 +02:00
parent efa1113eb2
commit badcc1d801
5 changed files with 69 additions and 1 deletions

View file

@ -11,7 +11,6 @@ on:
jobs:
build:
runs-on: ubuntu-latest
steps:
@ -23,3 +22,11 @@ jobs:
distribution: 'adopt'
- name: Build with Maven
run: mvn -B package --file pom.xml
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)

11
Dockerfile Normal file
View file

@ -0,0 +1,11 @@
FROM openjdk:8-jdk-alpine
LABEL Gabri Botha <bothagabri@gmail.com>
ENV TZ Africa/Johannesburg
ENV DEPLOY_STAGE staging
WORKDIR /app
COPY target/* /app/
ENTRYPOINT ["java","-jar","/app/*.jar"]

0
docker_build.sh Normal file
View file

27
scripts/docker_build.sh Normal file
View file

@ -0,0 +1,27 @@
#! /usr/bin/env bash
export DEPLOY_STAGE="development"
export CONTAINER_NAME="kubevisor_spring-petclinic"
export IMAGE_NAME="spring-petclinic:latest"
export CONTAINER_REGISTRY="registry.dev.bitco.co.za:4321/bitco/aarborpie"
# docker kill "$CONTAINER_NAME"
# docker rm "$CONTAINER_NAME"
docker_build_cmd="docker image build -t \"$IMAGE_NAME\" ."
docker_run_cmd="docker run -d --name \"$CONTAINER_NAME\""
docker_run_cmd+=" --env DEPLOY_STAGE=\"$DEPLOY_STAGE\"" \
docker_run_cmd+=" --restart always" \
docker_run_cmd+=" --log-opt max-size=10m" \
docker_run_cmd+=" --log-opt max-file=3" \
docker_run_cmd+=" \"$IMAGE_NAME\""
echo "build: $docker_build_cmd"
eval $docker_build_cmd
echo "run: $docker_run_cmd"
eval $docker_run_cmd

View file

@ -0,0 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-app-deployment
labels:
app: hello-app
spec:
replicas: 1
selector:
matchLabels:
app: hello-app
template:
metadata:
labels:
app: hello-app
spec:
nodeSelector:
type: backend
containers:
- name: hello-app
image: hello-app:v.01
ports:
- containerPort: 8080