From 8bdf2d2dbd698a71c40e20d3885f92aca85a6805 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Sun, 9 Feb 2020 16:11:19 +0200 Subject: [PATCH 1/4] Adding script/dock: simplifying testing/packaging --- script/dock | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 script/dock diff --git a/script/dock b/script/dock new file mode 100755 index 0000000..d17ae5d --- /dev/null +++ b/script/dock @@ -0,0 +1,30 @@ +#!/bin/bash + +# Usage: +# dock [arg] +# dock test: build gh-ost & run unit and integration tests +# docker alpine: build and run gh-ost on alpine linux +# docker pkg [target-path]: build gh-ost release packages and copy to target path (default path: /tmp/gh-ost-release) + +command="$1" + +case "$command" in + "test") + docker_target="gh-ost-test" + docker build . -f Dockerfile.test -t "${docker_target}" && docker run --rm -it "${docker_target}:latest" + ;; + "alpine") + docker_target="gh-ost-alpine" + docker build . -f Dockerfile -t "${docker_target}" && docker run --rm -it -p 3000:3000 "${docker_target}:latest" + ;; + "pkg") + packages_path="${2:-/tmp/gh-ost-release}" + docker_target="gh-ost-packaging" + docker build . -f Dockerfile.packaging -t "${docker_target}" && docker run --rm -it -v "${packages_path}:/tmp/pkg" "${docker_target}:latest" bash -c 'find /tmp/gh-ost-release/ -maxdepth 1 -type f | xargs cp -t /tmp/pkg' + echo "packages generated on ${packages_path}:" + ls -l "${packages_path}" + ;; + *) + >&2 echo "Usage: dock dock [arg]" + exit 1 +esac From 40953fe82f9db405cbd45f04ee4f473b2f0511ee Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Sun, 9 Feb 2020 16:11:34 +0200 Subject: [PATCH 2/4] Adding script/dock: simplifying testing/packaging --- build.sh | 4 ++-- script/dock | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/build.sh b/build.sh index b7f3a54..46db9c2 100755 --- a/build.sh +++ b/build.sh @@ -61,11 +61,11 @@ main() { mkdir -p ${buildpath} rm -rf ${buildpath:?}/* - build macOS osx darwin amd64 build GNU/Linux linux linux amd64 + # build macOS osx darwin amd64 echo "Binaries found in:" - ls -1 $buildpath/gh-ost-binary*${timestamp}.tar.gz + find $buildpath/gh-ost* -type f -maxdepth 1 } main "$@" diff --git a/script/dock b/script/dock index d17ae5d..486061d 100755 --- a/script/dock +++ b/script/dock @@ -1,9 +1,8 @@ #!/bin/bash # Usage: -# dock [arg] +# dock [arg] # dock test: build gh-ost & run unit and integration tests -# docker alpine: build and run gh-ost on alpine linux # docker pkg [target-path]: build gh-ost release packages and copy to target path (default path: /tmp/gh-ost-release) command="$1" @@ -13,10 +12,6 @@ case "$command" in docker_target="gh-ost-test" docker build . -f Dockerfile.test -t "${docker_target}" && docker run --rm -it "${docker_target}:latest" ;; - "alpine") - docker_target="gh-ost-alpine" - docker build . -f Dockerfile -t "${docker_target}" && docker run --rm -it -p 3000:3000 "${docker_target}:latest" - ;; "pkg") packages_path="${2:-/tmp/gh-ost-release}" docker_target="gh-ost-packaging" From f6ea377a4b372e2cf11645dbffd326d5a9f57a38 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Sun, 9 Feb 2020 16:11:50 +0200 Subject: [PATCH 3/4] Dockerfile.packaging --- Dockerfile.packaging | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Dockerfile.packaging diff --git a/Dockerfile.packaging b/Dockerfile.packaging new file mode 100644 index 0000000..6aa2ace --- /dev/null +++ b/Dockerfile.packaging @@ -0,0 +1,36 @@ +# Requires Docker 17.09 or later (multi stage builds) +# +# Orchestrator will look for a configuration file at /etc/orchestrator.conf.json. +# It will listen on port 3000. +# If not present a minimal configuration will be generated using the following environment variables: +# +# Default variables which can be used are: +# +# ORC_TOPOLOGY_USER (default: orchestrator): username used by orchestrator to login to MySQL when polling/discovering +# ORC_TOPOLOGY_PASSWORD (default: orchestrator): password needed to login to MySQL when polling/discovering +# ORC_DB_HOST (default: orchestrator): orchestrator backend MySQL host +# ORC_DB_PORT (default: 3306): port used by orchestrator backend MySQL server +# ORC_DB_NAME (default: orchestrator): database named used by orchestrator backend MySQL server +# ORC_USER (default: orc_server_user): username used to login to orchestrator backend MySQL server +# ORC_PASSWORD (default: orc_server_password): password used to login to orchestrator backend MySQL server + +FROM golang:1.12.6 + +RUN apt-get update +RUN apt-get install -y ruby ruby-dev rubygems build-essential +RUN gem install --no-ri --no-rdoc fpm +ENV GOPATH=/tmp/go + +RUN apt-get install -y curl +RUN apt-get install -y rsync +RUN apt-get install -y gcc +RUN apt-get install -y g++ +RUN apt-get install -y bash +RUN apt-get install -y git +RUN apt-get install -y tar +RUN apt-get install -y rpm + +RUN mkdir -p $GOPATH/src/github.com/github/gh-ost +WORKDIR $GOPATH/src/github.com/github/gh-ost +COPY . . +RUN bash build.sh From 85a285a9e4ecfd63f817c04f998b572a2fd18e5d Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Mon, 10 Feb 2020 08:59:44 +0200 Subject: [PATCH 4/4] cleanup --- Dockerfile.packaging | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Dockerfile.packaging b/Dockerfile.packaging index 6aa2ace..214c70c 100644 --- a/Dockerfile.packaging +++ b/Dockerfile.packaging @@ -1,18 +1,4 @@ -# Requires Docker 17.09 or later (multi stage builds) # -# Orchestrator will look for a configuration file at /etc/orchestrator.conf.json. -# It will listen on port 3000. -# If not present a minimal configuration will be generated using the following environment variables: -# -# Default variables which can be used are: -# -# ORC_TOPOLOGY_USER (default: orchestrator): username used by orchestrator to login to MySQL when polling/discovering -# ORC_TOPOLOGY_PASSWORD (default: orchestrator): password needed to login to MySQL when polling/discovering -# ORC_DB_HOST (default: orchestrator): orchestrator backend MySQL host -# ORC_DB_PORT (default: 3306): port used by orchestrator backend MySQL server -# ORC_DB_NAME (default: orchestrator): database named used by orchestrator backend MySQL server -# ORC_USER (default: orc_server_user): username used to login to orchestrator backend MySQL server -# ORC_PASSWORD (default: orc_server_password): password used to login to orchestrator backend MySQL server FROM golang:1.12.6