Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tarballing source into the images for dependencies that are required by their licenses. #634

Merged
merged 1 commit into from
Mar 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,12 @@ lint: $(ensure-build-image)
build-licenses:
docker run --rm $(common_mounts) $(build_tag) $(mount_path)/build/extract-licenses.sh

# Tarball source for dependencies that are required to be distributed with the image (MPL)
build-required-src-dist:
docker run --rm $(common_mounts) $(build_tag) $(mount_path)/build/build-required-src-dist.sh

# Build the image for the gameserver controller
build-controller-image: $(ensure-build-image) build-controller-binary build-licenses
build-controller-image: $(ensure-build-image) build-controller-binary build-licenses build-required-src-dist
docker build $(agones_path)/cmd/controller/ --tag=$(controller_tag) $(DOCKER_BUILD_ARGS)

# push the gameservers controller image
Expand Down Expand Up @@ -310,7 +314,7 @@ build-agones-sdk-binary-windows: $(ensure-build-image)
-o $(go_build_base_path)/cmd/sdk-server/bin/sdk-server.windows.amd64.exe $(go_rebuild_flags) $(go_version_flags) $(agones_package)/cmd/sdk-server

# Build the image for the gameserver sidecar
build-agones-sdk-image: $(ensure-build-image) build-agones-sdk-binary build-licenses
build-agones-sdk-image: $(ensure-build-image) build-agones-sdk-binary build-licenses build-required-src-dist
docker build $(agones_path)/cmd/sdk-server/ --tag=$(sidecar_tag) $(DOCKER_BUILD_ARGS)

# Build a static binary for the ping service
Expand All @@ -324,7 +328,7 @@ push-ping-image: $(ensure-build-image)
docker push $(ping_tag)

# Build the image for the ping service
build-ping-image: $(ensure-build-image) build-ping-binary build-licenses
build-ping-image: $(ensure-build-image) build-ping-binary build-licenses build-required-src-dist
docker build $(agones_path)/cmd/ping/ --tag=$(ping_tag) $(DOCKER_BUILD_ARGS)

# Build the cpp sdk linux archive
Expand Down
33 changes: 33 additions & 0 deletions build/build-required-src-dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

SRC_ROOT=$(dirname "${BASH_SOURCE}")/..

TMP_DEPS_SRC=/tmp/dependencies-src.tgz

# Pack the source code of dependencies that are MPL
tar -zcf ${TMP_DEPS_SRC} -C ${SRC_ROOT}/vendor/ \
github.com/hashicorp/golang-lru \
github.com/hashicorp/hcl

for ddir in ${SRC_ROOT}/cmd/controller/bin/ ${SRC_ROOT}/cmd/ping/bin/ ${SRC_ROOT}/cmd/sdk-server/bin/ ; do
mkdir -p ${ddir}
cp ${TMP_DEPS_SRC} ${ddir}
done

2 changes: 1 addition & 1 deletion cmd/controller/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apk --update add ca-certificates && \
adduser -D agones

COPY --chown=agones:root ./bin/controller /home/agones/controller
COPY --chown=agones:root ./bin/LICENSES /home/agones/LICENSES
COPY --chown=agones:root ./bin/LICENSES ./bin/dependencies-src.tgz /home/agones/

USER agones
ENTRYPOINT ["/home/agones/controller"]
2 changes: 1 addition & 1 deletion cmd/ping/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apk --update add ca-certificates && \
adduser -D agones

COPY --chown=agones:root ./bin/ping /home/agones/ping
COPY --chown=agones:root ./bin/LICENSES /home/agones/LICENSES
COPY --chown=agones:root ./bin/LICENSES ./bin/dependencies-src.tgz /home/agones/

USER agones
ENTRYPOINT ["/home/agones/ping"]
2 changes: 1 addition & 1 deletion cmd/sdk-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apk --update add ca-certificates && \
adduser -D agones

COPY --chown=agones:root ./bin/sdk-server.linux.amd64 /home/agones/sdk-server
COPY --chown=agones:root ./bin/LICENSES /home/agones/LICENSES
COPY --chown=agones:root ./bin/LICENSES ./bin/dependencies-src.tgz /home/agones/

USER agones
ENTRYPOINT ["/home/agones/sdk-server"]