-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9d8e539
Showing
5 changed files
with
125 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 @@ | ||
/.idea/ |
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,24 @@ | ||
FROM lapierre/java-alpine:8 | ||
|
||
MAINTAINER Adrian Lapierre <[email protected]> | ||
|
||
# Add the flyway user and step in the directory | ||
RUN addgroup -S flyway && adduser --home /flyway -S -G flyway flyway | ||
|
||
WORKDIR /flyway | ||
|
||
# Change to the flyway user | ||
USER flyway | ||
|
||
ENV FLYWAY_VERSION 7.0.3 | ||
|
||
RUN wget https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLYWAY_VERSION}/flyway-commandline-${FLYWAY_VERSION}.tar.gz \ | ||
&& tar -xzf flyway-commandline-${FLYWAY_VERSION}.tar.gz --strip-components=1 \ | ||
&& rm flyway-commandline-${FLYWAY_VERSION}.tar.gz | ||
|
||
ADD wait-for.sh wait-for.sh | ||
|
||
ENV PATH="/flyway:${PATH}" | ||
|
||
ENTRYPOINT ["flyway"] | ||
CMD ["-?"] |
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,12 @@ | ||
IMAGE_NAME=lapierre/flyway | ||
IMAGE_VERSION=7.0.3 | ||
|
||
build: | ||
docker build -t $(IMAGE_NAME):$(IMAGE_VERSION) . | ||
docker tag $(IMAGE_NAME):$(IMAGE_VERSION) $(IMAGE_NAME):latest | ||
docker tag $(IMAGE_NAME):$(IMAGE_VERSION) $(IMAGE_NAME):7 | ||
|
||
push: | ||
docker push $(IMAGE_NAME):$(IMAGE_VERSION) | ||
docker push $(IMAGE_NAME):latest | ||
docker push $(IMAGE_NAME):7 |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="WEB_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$" /> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
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,79 @@ | ||
#!/bin/sh | ||
|
||
TIMEOUT=15 | ||
QUIET=0 | ||
|
||
echoerr() { | ||
if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi | ||
} | ||
|
||
usage() { | ||
exitcode="$1" | ||
cat << USAGE >&2 | ||
Usage: | ||
$cmdname host:port [-t timeout] [-- command args] | ||
-q | --quiet Do not output any status messages | ||
-t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout | ||
-- COMMAND ARGS Execute command with args after the test finishes | ||
USAGE | ||
exit "$exitcode" | ||
} | ||
|
||
wait_for() { | ||
for i in `seq $TIMEOUT` ; do | ||
nc -z "$HOST" "$PORT" > /dev/null 2>&1 | ||
|
||
result=$? | ||
if [ $result -eq 0 ] ; then | ||
if [ $# -gt 0 ] ; then | ||
exec "$@" | ||
fi | ||
exit 0 | ||
fi | ||
sleep 1 | ||
done | ||
echo "Operation timed out" >&2 | ||
exit 1 | ||
} | ||
|
||
while [ $# -gt 0 ] | ||
do | ||
case "$1" in | ||
*:* ) | ||
HOST=$(printf "%s\n" "$1"| cut -d : -f 1) | ||
PORT=$(printf "%s\n" "$1"| cut -d : -f 2) | ||
shift 1 | ||
;; | ||
-q | --quiet) | ||
QUIET=1 | ||
shift 1 | ||
;; | ||
-t) | ||
TIMEOUT="$2" | ||
if [ "$TIMEOUT" = "" ]; then break; fi | ||
shift 2 | ||
;; | ||
--timeout=*) | ||
TIMEOUT="${1#*=}" | ||
shift 1 | ||
;; | ||
--) | ||
shift | ||
break | ||
;; | ||
--help) | ||
usage 0 | ||
;; | ||
*) | ||
echoerr "Unknown argument: $1" | ||
usage 1 | ||
;; | ||
esac | ||
done | ||
|
||
if [ "$HOST" = "" -o "$PORT" = "" ]; then | ||
echoerr "Error: you need to provide a host and port to test." | ||
usage 2 | ||
fi | ||
|
||
wait_for "$@" |