This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: docker:20.10.8 | |
services: | |
- docker:20.10.8-dind | |
variables: | |
DOCKER_DRIVER: overlay2 | |
BUILDX_VERSION: "v0.6.1" | |
BUILDX_ARCH: "linux-amd64" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from flask import Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def hello_world(): | |
return "<p>Hello, World!</p>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.8-alpine | |
RUN apk add --no-cache \ | |
curl \ | |
libffi-dev \ | |
openssl-dev \ | |
build-base &&\ | |
rm -rf /var/cache/apk/* | |
COPY requirements.txt . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# build and push docker image | |
docker buildx build \ | |
--platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le \ | |
--tag registry.gitlab.com/nicosingh/demo-flask-application:latest \ | |
--push \ | |
. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# log into gitlab container registry | |
docker login registry.gitlab.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# clone sample repo | |
git clone https://gitlab.com/nicosingh/demo-flask-application.git | |
cd demo-flask-application | |
# log into gitlab container registry | |
docker login registry.gitlab.com | |
# init buildx | |
docker buildx create --use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM centos:7 | |
RUN curl https://install.citusdata.com/community/rpm.sh --output rpm.sh && \ | |
chmod +x rpm.sh && \ | |
bash rpm.sh && \ | |
rm -f rpm.sh | |
RUN yum install -y \ | |
pg-auto-failover10_11\ | |
postgresql11-contrib \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create developers Role using RBAC | |
resource "kubernetes_cluster_role" "iam_roles_developers" { | |
metadata { | |
name = "${var.name_prefix}-developers" | |
} | |
rule { | |
api_groups = ["*"] | |
resources = ["pods", "pods/log", "deployments", "ingresses", "services"] | |
verbs = ["get", "list"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespaces = ["sample-apps"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create some variables | |
variable "namespaces" { | |
type = list(string) | |
description = "List of namespaces to be created in our EKS Cluster." | |
} | |
# create all Namespaces into EKS | |
resource "kubernetes_namespace" "eks_namespaces" { | |
for_each = toset(var.namespaces) |