Skip to content

Instantly share code, notes, and snippets.

View spalt08's full-sized avatar

Konstantin Darutkin spalt08

View GitHub Profile
@spalt08
spalt08 / docker-compose.yml
Created September 4, 2019 02:53
Go live-reload snippet
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 September 4, 2019 02:52
Go live-reload snippet
# 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 September 4, 2019 02:59
Go live-reload snippet
# 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: