test full deploy
This commit is contained in:
@@ -1,37 +1,29 @@
|
||||
variables:
|
||||
CI_PROJECT_DIR: "."
|
||||
CI_REGISTRY_IMAGE: hub.ducoterra.net/ducoterra/django
|
||||
CI_COMMIT_TAG: 3.8.2_1
|
||||
CI_COMMIT_TAG: 3.8.2_2
|
||||
|
||||
stages:
|
||||
# - build
|
||||
# - test
|
||||
- deploy
|
||||
|
||||
# push:
|
||||
# stage: build
|
||||
# image:
|
||||
# name: gcr.io/kaniko-project/executor:debug
|
||||
# entrypoint: [""]
|
||||
# script:
|
||||
# # - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
||||
# - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||
push:
|
||||
stage: build
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:debug
|
||||
entrypoint: [""]
|
||||
script:
|
||||
# - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
|
||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||
|
||||
# pip:
|
||||
# stage: test
|
||||
# image:
|
||||
# name: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||
# entrypoint: [""]
|
||||
# script:
|
||||
# - echo $(pip freeze)
|
||||
|
||||
# project:
|
||||
# stage: test
|
||||
# image:
|
||||
# name: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||
# entrypoint: [""]
|
||||
# script:
|
||||
# - django-admin startproject config .
|
||||
pip:
|
||||
stage: test
|
||||
image:
|
||||
name: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||
entrypoint: [""]
|
||||
script:
|
||||
- echo $(pip freeze)
|
||||
|
||||
pods:
|
||||
stage: deploy
|
||||
@@ -42,6 +34,4 @@ pods:
|
||||
- apt update && apt install -y curl
|
||||
- curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
|
||||
- chmod +x ./kubectl
|
||||
- ls -lah
|
||||
- ./kubectl version --client
|
||||
- ./kubectl get po
|
||||
- envsubst < deploy.yml | kubectl apply -f -
|
||||
@@ -1,3 +1,7 @@
|
||||
FROM python:3.8.2
|
||||
|
||||
RUN pip install django
|
||||
WORKDIR /app
|
||||
RUN django-admin startproject config .
|
||||
|
||||
CMD ["python","manage.py","runserver","8080"]
|
||||
25
k8s/deploy.yaml
Normal file
25
k8s/deploy.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: test
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: test
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: test
|
||||
spec:
|
||||
containers:
|
||||
- name: test
|
||||
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||
resources:
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "250m"
|
||||
requests:
|
||||
memory: "1Mi"
|
||||
cpu: "1m"
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
18
k8s/ingress.yaml
Normal file
18
k8s/ingress.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
ingress.kubernetes.io/ssl-redirect: "true"
|
||||
name: test
|
||||
spec:
|
||||
tls:
|
||||
- hosts:
|
||||
- test.ducoterra.net
|
||||
secretName: letsencrypt
|
||||
rules:
|
||||
- host: test.ducoterra.net
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: test
|
||||
servicePort: 8000
|
||||
10
k8s/service.yaml
Normal file
10
k8s/service.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: test
|
||||
spec:
|
||||
selector:
|
||||
app: test
|
||||
ports:
|
||||
- port: 8000
|
||||
targetPort: 8000
|
||||
Reference in New Issue
Block a user