- works with docker-compose and kind
- uses cespare/reflex to watch .go and .html files changes and recompile/restart your server application
- optionally compiles with data race detector
- supports amd64 and arm64 architectures
- please open a new issue
Place docker-compose.yml in your project root and run docker-compose up --build
.
version: '3.8'
services:
myservice:
image: acim/go-reflex
environment:
- RACE_DETECTOR=1
volumes:
- .:/app
ports:
- 3000:3000
Note: Replace port number with correct port number of your application.
version: '3.8'
services:
myservice:
image: acim/go-reflex
environment:
- RACE_DETECTOR=1
- BUILD_ARGS=./cmd/server/server.go
volumes:
- .:/app
ports:
- 3000:3000
version: '3.8'
services:
myservice:
image: acim/go-reflex
environment:
- RACE_DETECTOR=1
- APT_INSTALL=libraw-dev
volumes:
- .:/app
ports:
- 3000:3000
go install sigs.k8s.io/kind@latest
kind create cluster --config=config.yaml
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
extraMounts:
- hostPath: /path/to/your/project/root
containerPath: /app
kubectl apply -f deploy.yaml
apiVersion: v1
kind: Pod
metadata:
name: your-app-name
namespace: default
spec:
containers:
- image: acim/go-reflex
name: your-app-name
env:
- name: RACE_DETECTOR
value: '1'
volumeMounts:
- mountPath: /app
name: app
restartPolicy: Never
volumes:
- hostPath:
path: /app
name: app
kubectl port-forward your-app-name 3000:3000
Note: Replace port number with correct port number of your application.
- RACE_DETECTOR=1 - used to turn on data race detector to the compiled binary
- RUN_ARGS - used to add subcommands and/or flags in the call of your binary (i.e. serve --verbose)
- BUILD_ARGS - used to add flags to go build command (i.e. "./cmd/myapp/main.go")
- APT_INSTALL - used to install additional packages (experimental and not efficient)