//go:build mage // +build mage package main import ( // mage:import . "magefile/docker" ) var ( GolangVolume = "/gopath/go/1.17" ) func init() { AppName = "godog" ImageName = "my/go" } func Test() { Bash(`sudo docker run -ti --rm \ -h host \ --net=bridge \ -v /etc/localtime:/etc/localtime:ro \ -v ` + GolangVolume + `:/usr/local/go:ro \ \ -v /gopath:/gopath:rw \ -v ${PWD}:/app \ \ -e GOPATH=/gopath \ -e GOCACHE=/gopath/gocache \ \ -w /app \ -u 1000 \ \ --entrypoint=/bin/bash \ \ ` + ImageName + " -c '" + `set -x; \ make test \ '`) } func TestSnippets() { Bash(`sudo docker run -ti --rm \ -h host \ --net=bridge \ -v /etc/localtime:/etc/localtime:ro \ -v ` + GolangVolume + `:/usr/local/go:ro \ \ -v /gopath:/gopath:rw \ -v ${PWD}:/app \ \ -e GOPATH=/gopath \ -e GOCACHE=/gopath/gocache \ \ -w /app \ -u 1000 \ \ --entrypoint=/bin/bash \ \ ` + ImageName + " -c '" + `set -x; \ godog run -f progress -c 4 \ features/snippets.feature \ '`) } func Install() { Bash(`sudo docker run -ti --rm \ -h host \ --net=bridge \ -v /etc/localtime:/etc/localtime:ro \ -v ` + GolangVolume + `:/usr/local/go:ro \ \ -v /gopath:/gopath:rw \ -v ${PWD}:/app \ \ -e GOPATH=/gopath \ -e GOCACHE=/gopath/gocache \ \ -w /app \ -u 1000 \ \ --entrypoint=/bin/bash \ \ ` + ImageName + " -c '" + `set -x; \ go install ./cmd/godog \ '`) }