-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from yardenshoham/docker
Add Dockerfile
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
** | ||
|
||
!config | ||
!formatter | ||
!*.go | ||
!go.mod | ||
!sample-config.toml | ||
!docker-entrypoint.sh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM alpine:3.12 AS permissions-giver | ||
|
||
# Make sure docker-entrypoint.sh is executable, regardless of the build host. | ||
WORKDIR /out | ||
COPY docker-entrypoint.sh . | ||
RUN chmod +x docker-entrypoint.sh | ||
|
||
FROM golang:1.14-alpine3.12 AS builder | ||
|
||
# Build wuzz | ||
WORKDIR /out | ||
COPY . . | ||
RUN go build . | ||
|
||
FROM alpine:3.12 AS organizer | ||
|
||
# Prepare executables | ||
WORKDIR /out | ||
COPY --from=builder /out/wuzz . | ||
COPY --from=permissions-giver /out/docker-entrypoint.sh . | ||
|
||
FROM alpine:3.12 AS runner | ||
WORKDIR /wuzz | ||
COPY --from=organizer /out /usr/local/bin | ||
ENTRYPOINT [ "docker-entrypoint.sh" ] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then | ||
sleep 0.01 | ||
set -- wuzz "$@" | ||
fi | ||
|
||
exec "$@" |