Skip to content

Instantly share code, notes, and snippets.

Avatar

Konstantin Darutkin spalt08

View GitHub Profile
@spalt08
spalt08 / docker-compose.yml
Created Sep 4, 2019
Go live-reload snippet
View docker-compose.yml
version: '3.7'
services:
# Production container. Builds in release mode and run. Project will be restarted on every abort.
production:
hostname: my-app-production
restart: unless-stopped
build:
context: .
dockerfile: Dockerfile
@spalt08
spalt08 / Dockerfile
Created Sep 4, 2019
Go live-reload snippet
View Dockerfile
# Production environment (alias: base)
FROM golang:1.12-alpine as base
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
WORKDIR /home/my-project
# Development environment
# Unfortunately, linux alpine doesn't have fswatch package by default, so we will need to download source code and make it by outselves.
FROM base as dev
RUN apk add --no-cache autoconf automake libtool gettext gettext-dev make g++ texinfo curl
@spalt08
spalt08 / Makefile
Last active Sep 4, 2019
Go live-reload snippet
View Makefile
# Variable for filename for store running procees id
PID_FILE = /tmp/my-app.pid
# We can use such syntax to get main.go and other root Go files.
GO_FILES = $(wildcard *.go)
# Start task performs "go run main.go" command and writes it's process id to PID_FILE.
start:
go run $(GO_FILES) & echo $$! > $(PID_FILE)
# You can also use go build command for start task
# start: