Skip to content

Instantly share code, notes, and snippets.

View ivorscott's full-sized avatar

Ivor Scott Cummings ivorscott

View GitHub Profile
dump:
@echo [ dumping postgres backup for $(POSTGRES_DB)... ]
@docker exec -it db pg_dump --username $(POSTGRES_USER) $(POSTGRES_DB) > ./api/scripts/backup.sql
@echo $(SUCCESS)
docker build --target test --tag demo/client:test ./client
docker build --target test --tag demo/api:test ./api
dlv debug --accept-multiclient --continue --headless --listen=:2345 --api-version=2 --log ./cmd/api/
CompileDaemon --build="go build -o main ./cmd/api" --command=./main
#!/bin/bash
set -e
if [ ! -f "/docker-entrypoint-initdb.d/backup.sql" ]; then
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -- <<-EOSQL
CREATE TABLE products (
id serial primary key,
name varchar(100) not null,
price real not null,
ifeq (,$(findstring postgres-net,$(NETWORKS)))
# do something
endif
#!make
NETWORKS="$(shell docker network ls)"
VOLUMES="$(shell docker volume ls)"
POSTGRES_DB="$(shell cat ./secrets/postgres_db)"
POSTGRES_USER="$(shell cat ./secrets/postgres_user)"
POSTGRES_PASSWORD="$(shell cat ./secrets/postgres_passwd)"
SUCCESS=[ done "\xE2\x9C\x94" ]
# default arguments
client:
build:
context: ./client
target: dev
ports:
- 3000:3000
volumes:
- ./client:/client/app
- /client/app/node_modules
networks:
- "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.http-catchall.entrypoints=web"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https@docker"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
traefik:
image: traefik:v2.1.2
command:
- "--api.insecure=true" # Not For Production
- "--api.debug=true"
- "--log.level=DEBUG"
- "--providers.docker"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=traefik-public"
- "--entrypoints.web.address=:80"