Skip to content

Instantly share code, notes, and snippets.

View EnriqueTejeda's full-sized avatar
🌎
Hack the planet!

Enrique Tejeda EnriqueTejeda

🌎
Hack the planet!
View GitHub Profile
@EnriqueTejeda
EnriqueTejeda / cloudfront-function-rewrite.js
Last active August 3, 2022 17:20
CloudFront Function to rewrite uri in s3 backend (leave only the last path) & add index.html for static websites
function handler(event) {
var request = event.request;
// Example:
// Input: /app1/assets/test.jpg
// Output: /assets/test.jpg
request.uri = request.uri.replace(/^\/[^/]*\//, "/");
// Check whether the URI is missing a file name.
if (request.uri.endsWith('/')) {
@EnriqueTejeda
EnriqueTejeda / Dockerfile
Created June 10, 2022 18:33
Dockerfile Multi-stage Nodejs
FROM node:16 AS BUILDER
WORKDIR /app
COPY . .
RUN npm install --prod
RUN npm run build
FROM node:16-slim
ENV TZ=America/Cancun
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
WORKDIR /app
@EnriqueTejeda
EnriqueTejeda / docker-compose.yaml
Created April 26, 2022 16:53
Docker-compose for setting up a mongodb & mongoclient container
version: '2'
services:
mongodb:
image: mongo:latest
container_name: mongodb
hostname: mongodb
ports:
- 27017:27017
mongoclient:
@EnriqueTejeda
EnriqueTejeda / docker-compose.yaml
Last active December 27, 2021 18:44
A simple way for secure your containers with azure login (nginx, oauth2-proxy and redis container)
version: '3'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- "./nginx.tmpl:/app/nginx.tmpl"
@EnriqueTejeda
EnriqueTejeda / docker-compose-elasticsearch-kibana-tls.yaml
Created August 12, 2021 15:57
Elasticsearch & Kibana with TLS / X-Pack Security Enabled
version: '2.2'
services:
elasticsearch-master-tls:
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1
container_name: elasticsearch-master-tls
environment:
- node.name=elasticsearch-master-tls
- cluster.name=elasticsearch-cluster-server
- cluster.initial_master_nodes=elasticsearch-master-tls
- bootstrap.memory_lock=true
@EnriqueTejeda
EnriqueTejeda / docker-compose.yml
Last active July 9, 2020 18:57
A example for generate a complete stack web which consist in reverse nginx proxy,webserver, mysql database & phpmyadmin, all with docker-compose
version : '3'
services:
mysql: # Up the database
image: mariadb:5.5
container_name: mysql
environment:
MYSQL_USER: user
MYSQL_PASSWORD: user
MYSQL_ROOT_PASSWORD: root