Skip to content

Instantly share code, notes, and snippets.

View sgyyz's full-sized avatar
🎯
Focusing

Yongzhi Yang sgyyz

🎯
Focusing
View GitHub Profile
version: '3'
services:
mysql:
image: mysql:5.7
ports:
- "3306:3306"
command: "mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci"
volumes:
- mysql-dataset:/var/lib/mysql
@sgyyz
sgyyz / docker-compose.yml
Created January 20, 2020 01:17
OpenLdap & Phpldapadmin docker-compose.yml
version: '3'
services:
openldap:
image: osixia/openldap:1.3.0
ports:
- '389:389'
- '636:636'
phpldapadmin:
@sgyyz
sgyyz / docker-compose.yml
Last active July 4, 2022 04:13
Postgres & PgAdmin docker-compose.yml
version: '3'
services:
postgres:
image: postgres
ports:
- "5432:5432"
volumes:
- pg-dataset:/var/lib/postgresql/data
environment:
@sgyyz
sgyyz / base_calculator.ex
Last active May 7, 2019 03:43
Elixir Abstract and Extends
defmodule BaseCalculator do
@moduledoc """
Define the base calculator and provide public API.
Define the callback to implement specific logic in child module.
"""
# it should be implemented by child module
@callback do_calculate(num1 :: Integer.t(), num2 :: Integer.t()) :: {:ok, Integer.t()} | {:error, any()}
defmacro __using__(_opts) do
## ....
environment :prod do
set include_erts: true
set include_src: false
set cookie: :"8[^a{lsZs|em/)Xg^pI}m2hXlmbzuuioM|[6mB6Pbno9MFuzWCNN{9TvK}(%]D<S"
set vm_args: "rel/vm.args"
set pre_start_hooks: "rel/hooks/pre_start"
set post_start_hooks: "rel/hooks/post_start"
end
#!/usr/bin/env bash
### Comment below block if it's a command ###
set +e
while true; do
nodetool ping
EXIT_CODE=$?
if [[ ${EXIT_CODE} -eq 0 ]]; then
echo "Application is up!"
#!/usr/bin/env bash
echo "Running database creation"
bin/dockerize_elixir command Elixir.Release.Tasks create_db
echo "DB created successfully"
defmodule Release.Tasks do
@start_apps [
:postgrex,
:ecto,
:ecto_sql
]
@app_mods [
DockerizeElixir
]
$ docker build --build-arg APP_NAME=dockerize_elixir --build-arg APP_VSN=0.1.0 --build-arg SKIP_PHOENIX=true -t app:0.1.0 .
# The version of Alpine to use for the final image
# This should match the version of Alpine that the `elixir:1.7.2-alpine` image uses
ARG ALPINE_VERSION=3.8
FROM elixir:1.7.2-alpine AS builder
# The following are build arguments used to change variable parts of the image.
# The name of your application/release (required)
ARG APP_NAME
# The version of the application we are building (required)