Skip to content

Instantly share code, notes, and snippets.

View nicosingh's full-sized avatar

Nico Singh nicosingh

View GitHub Profile
image: docker:20.10.8
services:
- docker:20.10.8-dind
variables:
DOCKER_DRIVER: overlay2
BUILDX_VERSION: "v0.6.1"
BUILDX_ARCH: "linux-amd64"
#!/usr/bin/env python
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_world():
return "<p>Hello, World!</p>"
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 .
# 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 \
.
# log into gitlab container registry
docker login registry.gitlab.com
# 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
@nicosingh
nicosingh / Dockerfile
Last active September 4, 2022 18:09
pg_auto_failover sample cluster
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 \
# 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"]
namespaces = ["sample-apps"]
# 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)