Created
September 4, 2019 02:53
-
-
Save spalt08/07f8ba292852a054574044b3c1d00726 to your computer and use it in GitHub Desktop.
Go live-reload snippet
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 | |
target: base | |
environment: | |
GIN_MODE: "release" # Example ENV variable | |
SERVING_PORT: "*:8080" # Example ENV variable | |
volumes: | |
- .:/home/my-app | |
working_dir: /home/my-app | |
ports: | |
- "8080:8080" # Opened ports | |
command: bash -c "go mod download && go build -o /bin/my-app . && /bin/my-app" | |
# Development container. Runs in debug mode and live-reloading on every source file update. | |
development: | |
hostname: my-app-development | |
restart: unless-stopped | |
build: | |
context: . | |
dockerfile: Dockerfile | |
target: dev | |
environment: | |
DEBUG: "true" # Example ENV variable | |
SERVING_PORT: ":8081" # Example ENV variable | |
volumes: | |
- ./home/my-app | |
working_dir: /home/my-app | |
ports: | |
- "8081:8081" | |
command: bash -c "go mod download && make serve" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment