This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |