Skip to content

Instantly share code, notes, and snippets.

@keitaj
Created February 4, 2020 12:16
Show Gist options
  • Save keitaj/165e59af34b6d88f90ffb2a723d074f7 to your computer and use it in GitHub Desktop.
Save keitaj/165e59af34b6d88f90ffb2a723d074f7 to your computer and use it in GitHub Desktop.
Run the executable docker container
version: "3.7"
services:
ecs-task:
image: ecs-task:latest
container_name: ecs-task
build:
context: ./
dockerfile: Dockerfile
environment:
- GO_ENV=docker
FROM golang:1.13.7-alpine3.10
ADD . /go/src/workspace/ecs-task
WORKDIR /go/src/workspace/ecs-task
RUN go build -o ecs-task && mv ecs-task /bin
ENTRYPOINT ecs-task

ファイル構成

  • ecs-task/docker-compose.yml
  • ecs-task/Dockerfile
  • ecs-task/main.go
$ cd ecs-task
$ docker-compose build
$ docker-compose run --rm ecs-task
Hello
package main
import (
"fmt"
"os"
)
func main() {
fmt.Println("Hello")
os.Exit(0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment