This file contains hidden or 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
services: | |
golang-dev-server: | |
build: | |
context: . | |
container_name: golang-dev-server | |
restart: unless-stopped | |
ports: | |
- "8080:8080" | |
volumes: | |
- ./:/app |
This file contains hidden or 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
# Dev Dockerfile: runs with Air for live reload and expects source to be mounted | |
ARG GO_VERSION=1.24.5 | |
FROM golang:${GO_VERSION}-alpine AS dev | |
WORKDIR /app | |
RUN apk update | |
RUN apk add --upgrade pngquant imagemagick libheif ghostscript |
This file contains hidden or 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
# Working directory | |
# . or absolute path, please note that the directories following must be under root. | |
root = "." | |
tmp_dir = "tmp" | |
[build] | |
# Just plain old shell command. You could use `make` as well. | |
cmd = "go build -o ./tmp/main ." | |
# Binary file yields from `cmd`. | |
bin = "tmp/main" |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
) | |
func rootHandler(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "Hello from GoLang") |