1.0
This commit is contained in:
parent
ae9d1f825a
commit
b95d9530a9
@ -4,7 +4,7 @@ stages:
|
|||||||
|
|
||||||
.kube-context:
|
.kube-context:
|
||||||
before_script:
|
before_script:
|
||||||
- if [ -n "$KUBE_CONTEXT" ]; then kubectl config use-context "$KUBE_CONTEXT"; fi
|
- if [ -n "$KUBE_CONTEXT" ]; then kubectl config use-context "$KUBE_CONTEXT"; fi
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
@ -12,28 +12,27 @@ build:
|
|||||||
variables:
|
variables:
|
||||||
STORAGE_DRIVER: vfs
|
STORAGE_DRIVER: vfs
|
||||||
BUILDAH_FORMAT: docker
|
BUILDAH_FORMAT: docker
|
||||||
FQ_IMAGE_NAME: "$REGISTRY/yaemiku/$CI_PROJECT_NAME"
|
IMAGE: "$REGISTRY/$REGISTRY_USERNAME/$CI_PROJECT_NAME"
|
||||||
before_script:
|
before_script:
|
||||||
- buildah login -u "$REGISTRY_USERNAME" -p "$REGISTRY_PASSWORD" "$REGISTRY"
|
- buildah login -u "$REGISTRY_USERNAME" -p "$REGISTRY_PASSWORD" "$REGISTRY"
|
||||||
script:
|
script:
|
||||||
- buildah images
|
- buildah images
|
||||||
- buildah build -t $FQ_IMAGE_NAME -t $FQ_IMAGE_NAME #:$CI_COMMIT_TAG
|
- buildah build -t $IMAGE:latest -t $IMAGE:$CI_COMMIT_TAG
|
||||||
- buildah images
|
- buildah images
|
||||||
- buildah push --all $FQ_IMAGE_NAME
|
- buildah push --all $IMAGE
|
||||||
after_script:
|
after_script:
|
||||||
- buildah logout "$REGISTRY"
|
- buildah logout "$REGISTRY"
|
||||||
# rules:
|
rules:
|
||||||
# - if: $CI_COMMIT_TAG
|
- if: $CI_COMMIT_TAG
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
|
when: always
|
||||||
extends: [.kube-context]
|
extends: [.kube-context]
|
||||||
image:
|
image:
|
||||||
name: bitnami/kubectl:latest
|
name: bitnami/kubectl:latest
|
||||||
entrypoint: [""]
|
entrypoint: [""]
|
||||||
script:
|
script:
|
||||||
- ls
|
- ls
|
||||||
- kubectl apply -f $CI_PROJECT_DIR/hamburger.yaml
|
- cat $CI_PROJECT_DIR/deployment.yaml | envsubst | kubectl apply -f -
|
||||||
- kubectl get pods
|
- kubectl get pods
|
||||||
# rules:
|
|
||||||
# - if: $CI_COMMIT_TAG
|
|
||||||
|
65
deployment.yaml
Normal file
65
deployment.yaml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: hamburger
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: hamburger
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: hamburger
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: hamburger
|
||||||
|
image: "$REGISTRY/$REGISTRY_USERNAME/$CI_PROJECT_NAME"
|
||||||
|
ports:
|
||||||
|
- name: app-port
|
||||||
|
containerPort: 3000
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "64Mi"
|
||||||
|
cpu: "250m"
|
||||||
|
limits:
|
||||||
|
memory: "128Mi"
|
||||||
|
cpu: "500m"
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: hamburger
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: app-svc-port
|
||||||
|
port: 80
|
||||||
|
targetPort: app-port
|
||||||
|
selector:
|
||||||
|
app: hamburger
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: traefik.containo.us/v1alpha1
|
||||||
|
kind: IngressRoute
|
||||||
|
metadata:
|
||||||
|
name: hamburger
|
||||||
|
spec:
|
||||||
|
entryPoints:
|
||||||
|
- websecure
|
||||||
|
routes:
|
||||||
|
- kind: Rule
|
||||||
|
match: Host(`yaemiku.dev`)
|
||||||
|
services:
|
||||||
|
- kind: Service
|
||||||
|
name: hamburger
|
||||||
|
port: app-svc-port
|
||||||
|
tls:
|
||||||
|
secretName: hamburger-tls
|
||||||
|
certResolver: letsencrypt-prod
|
||||||
|
domains:
|
||||||
|
- main: yaemiku.dev
|
||||||
|
sans:
|
||||||
|
- www.yaemiku.dev
|
@ -1,60 +0,0 @@
|
|||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: hamburger
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: hamburger
|
|
||||||
replicas: 1
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app: hamburger
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: hamburger
|
|
||||||
image: registry.yaemiku.dev/yaemiku/hamburger:latest
|
|
||||||
ports:
|
|
||||||
- containerPort: 3000
|
|
||||||
imagePullSecrets:
|
|
||||||
- name: regcred
|
|
||||||
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: hamburger
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- port: 3000
|
|
||||||
name: nextjs
|
|
||||||
selector:
|
|
||||||
app: hamburger
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
apiVersion: networking.k8s.io/v1
|
|
||||||
kind: Ingress
|
|
||||||
metadata:
|
|
||||||
name: hamburger
|
|
||||||
annotations:
|
|
||||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
|
||||||
traefik.ingress.kubernetes.io/router.middlewares: default-redirect-https@kubernetescrd
|
|
||||||
spec:
|
|
||||||
ingressClassName: traefik
|
|
||||||
rules:
|
|
||||||
- host: yaemiku.dev
|
|
||||||
http:
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
pathType: Prefix
|
|
||||||
backend:
|
|
||||||
service:
|
|
||||||
name: hamburger
|
|
||||||
port:
|
|
||||||
name: nextjs
|
|
||||||
tls:
|
|
||||||
- secretName: hamburger-tls
|
|
||||||
hosts:
|
|
||||||
- yaemiku.dev
|
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hamburger",
|
"name": "hamburger",
|
||||||
"version": "0.1.0",
|
"version": "1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
Loading…
Reference in New Issue
Block a user