Skip to content

Commit

Permalink
Multi stage build (#20)
Browse files Browse the repository at this point in the history
* Introduce docker multi-stage build

* Whitelist files in .dockerignore

* Use alias for first stage in dockerfile
  • Loading branch information
Nick-Triller authored and Marc Rooding committed Sep 23, 2018
1 parent 56f5154 commit 56a4d94
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
7 changes: 6 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
flink-sample-job/
# Exclude everything
**

# Whitelist
!cmd
!vendor
!flink-sample-job/target/
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM alpine:3.8

COPY cli /flink-deployer/cli
FROM golang:1.10.4-alpine3.8 as build
WORKDIR /go/src/github.com/ing-bank/flink-deployer/
COPY . .
RUN go build ./cmd/cli

FROM alpine:3.8
WORKDIR /flink-deployer

COPY --from=build /go/src/github.com/ing-bank/flink-deployer/cli .
VOLUME [ "/data/flink" ]

ENTRYPOINT [ "/flink-deployer/cli" ]
CMD [ "help" ]
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For a full overview of the commands and flags, run `flink-job-deployer help`

To be able to test the deployer locally, follow these steps:

1. Build the CLI tool: `env GOOS=linux GOARCH=amd64 go build ./cmd/cli && docker-compose build deployer`
1. Build the CLI tool docker image: `docker-compose build deployer`
2. ***optional***: `cd flink-sample-job; sbt clean assembly; cd ..` (Builds a jar with small stateful test job)
3. `docker-compose up -d jobmanager taskmanager` (start a Flink job- and taskmanager)
4. `docker-compose run deployer help` (run the Flink deployer with argument `help`)
Expand Down Expand Up @@ -79,7 +79,6 @@ env GOOS=linux GOARCH=amd64 go build ./cmd/cli
Build the Docker container locally to test CLI tool:

```bash
go build ./cmd/cli
docker-compose build deployer
```

Expand Down

0 comments on commit 56a4d94

Please # to comment.