diff --git a/test/Dockerfile b/test/Dockerfile new file mode 100644 index 0000000..68b5765 --- /dev/null +++ b/test/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine:latest + +COPY . /app diff --git a/test/docker-compose.yml b/test/docker-compose.yml new file mode 100644 index 0000000..118f07e --- /dev/null +++ b/test/docker-compose.yml @@ -0,0 +1,25 @@ +version: "3.5" +services: + my-service: + build: + dockerfile: Dockerfile + context: . + command: /app/print-random-stuff.sh + depends_on: + - my-service2 + ports: + - 123:321 + + my-service2: + build: + dockerfile: Dockerfile + context: . + command: /app/print-random-stuff.sh + ports: + - 12345:12345 + + my-service3: + build: + dockerfile: Dockerfile + context: . + command: /app/print-random-stuff.sh diff --git a/test/print-random-stuff.sh b/test/print-random-stuff.sh new file mode 100755 index 0000000..cff8d71 --- /dev/null +++ b/test/print-random-stuff.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +while true +do + echo $((1 + $RANDOM % 10)) + sleep 1 +done diff --git a/test/printrandom/Dockerfile b/test/printrandom/Dockerfile deleted file mode 100644 index 9faa4c5..0000000 --- a/test/printrandom/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# building the binary -FROM golang:1.11 as builder - -# Add Maintainer Info -LABEL maintainer="Jesse Duffield " - -# Set the Current Working Directory inside the container -WORKDIR /src/github.com/jesseduffield/lazydocker/test/printrandom - -# Copy everything from the current directory to the PWD(Present Working Directory) inside the container -COPY . . - -# Build the package -RUN go build - -# putting binary into a minimal image -FROM scratch - -WORKDIR /root/ - -COPY --from=builder /src/github.com/jesseduffield/lazydocker/test/printrandom/printrandom . - -# Run the executable -CMD ["./printrandom"] \ No newline at end of file diff --git a/test/printrandom/main.go b/test/printrandom/main.go deleted file mode 100644 index 41e6fac..0000000 --- a/test/printrandom/main.go +++ /dev/null @@ -1,26 +0,0 @@ -package main - -import ( - "fmt" - "math/rand" - "os" - "os/signal" - "time" -) - -func main() { - exitOnInterrupt() - - for range time.Tick(time.Second / 3) { - fmt.Println(rand.Intn(1000)) - } -} - -func exitOnInterrupt() { - c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt) - go func() { - <-c - os.Exit(0) - }() -} diff --git a/test/printrandom/printrandom b/test/printrandom/printrandom deleted file mode 100755 index b6f06c8..0000000 Binary files a/test/printrandom/printrandom and /dev/null differ