Skip to content

Instantly share code, notes, and snippets.

View alexei-led's full-sized avatar
🤖
Don't panic!

Alexei Ledenev alexei-led

🤖
Don't panic!
View GitHub Profile
@alexei-led
alexei-led / fix_boot2docker_tsl
Created July 9, 2015 08:19
Fix boot2docker TSL error: "...certificate is valid for 127.0.0.1, 10.0.2.15, not ..." for IP
# SSH to Boot2Docker with `boot2docker ssh`
# add your IP to command bellow, run this command as superuser
/usr/local/bin/generate_cert --host=boot2docker,127.0.0.1,10.0.2.15,192.168.59.103 --ca=/var/lib/boot2docker/tls/ca.pem --ca-key=/var/lib/boot2docker/tls/cakey.pem --cert=/var/lib/boot2docker/tls/server.pem --key=/var/lib/boot2docker/tls/serverkey.pem
@alexei-led
alexei-led / print_ips.go
Last active March 10, 2016 22:31
Print list of valid IPs from passed string
package main
import (
"fmt"
"strconv"
)
type tree struct {
nodes []*tree
@alexei-led
alexei-led / Dockerfile
Created March 16, 2016 08:39
App & Test container Dockerfile
FROM "<bases image>":"<version>"
WORKDIR "<path>"
# install packages required to run app and tests
RUN apt-get update && apt-get install -y \
"<app runtime> and <dependencies>" \ # add app runtime and required packages
"<test tools> and <dependencies>" \ # add testing tools and required packages
&& rm -rf /var/lib/apt/lists/*
@alexei-led
alexei-led / Dockerfile
Created March 16, 2016 08:48
Dockerfile with ONTEST instruction
FROM "<base image>":"<version>"
WORKDIR "<path>"
# install packages required to run app
RUN apt-get update && apt-get install -y \
"<app runtime> and <dependencies>" \ # add app runtime and required packages
&& rm -rf /var/lib/apt/lists/*
# install packages required to run tests
@alexei-led
alexei-led / docker-test.sh
Last active September 13, 2018 05:19
docker-test command (simple implementation)
#!/bin/bash
image="app"
tag="latest"
echo "FROM ${image}:${tag}" > Dockerfile.test && \
docker build -t "${image}:${tag}-test" -f Dockerfile.test . && \
docker run -it --rm -v $(pwd)/tests/results:/var/tests/results "${image}:${tag}-test" && \
rm Dockerfile.test
@alexei-led
alexei-led / create_swarm_cluster.sh
Last active April 15, 2024 20:45
Deploy Docker Compose (v3) to Swarm (mode) Cluster
#!/bin/bash
# vars
[ -z "$NUM_WORKERS" ] && NUM_WORKERS=3
# init swarm (need for service command); if not created
docker node ls 2> /dev/null | grep "Leader"
if [ $? -ne 0 ]; then
docker swarm init > /dev/null 2>&1
fi
@alexei-led
alexei-led / build.Dockerfile
Created March 17, 2017 11:33
Dockerize Java-Maven project
FROM maven:{{}}
# make source folder
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# install maven packages
COPY pom.xml /usr/src/app
CMD ["mvn", "install"]
@alexei-led
alexei-led / gitconfig.ini
Created April 21, 2017 14:44 — forked from tdd/gitconfig.ini
Nice, useful global Git configuration
# Put this in your ~/.gitconfig or ~/.config/git/config
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName>
[user]
name = Your Full Name
email = your@email.tld
[color]
# Enable colors in color-supporting terminals
ui = auto
[alias]
st = status
@alexei-led
alexei-led / clean-docker-for-mac.sh
Created April 23, 2017 08:41 — forked from MrTrustor/clean-docker-for-mac.sh
This script cleans the Docker.qcow2 file that takes a lot of disk space with Docker For Mac. You can specify some Docker images that you would like to keep.
#!/bin/bash
# Copyright 2017 Théo Chamley
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
@alexei-led
alexei-led / bash-menu.sh
Created January 15, 2019 06:32 — forked from nwaywood/bash-menu.sh
Template structure for a bash script with simple menu and command line args
#! /bin/bash
# ===================
# Script funtionality
# ===================
# do something
doSomething() {
echo 'doing something'
}