mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-27 01:15:49 +00:00
Add github workflow, dockerfile, kubefile, and some scriptsd
This commit is contained in:
parent
efa1113eb2
commit
badcc1d801
5 changed files with 69 additions and 1 deletions
9
.github/workflows/maven.yml
vendored
9
.github/workflows/maven.yml
vendored
|
@ -11,7 +11,6 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -23,3 +22,11 @@ jobs:
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
run: mvn -B package --file pom.xml
|
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
11
Dockerfile
Normal 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
0
docker_build.sh
Normal file
27
scripts/docker_build.sh
Normal file
27
scripts/docker_build.sh
Normal 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
|
23
spring-petclinic-deployment.yaml
Normal file
23
spring-petclinic-deployment.yaml
Normal 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
|
Loading…
Reference in a new issue