Skip to content

Instantly share code, notes, and snippets.

@zombiezen
Created June 5, 2017 15:39
Show Gist options
  • Save zombiezen/f5babb45ce7d330965f256e587bacb8c to your computer and use it in GitHub Desktop.
Save zombiezen/f5babb45ce7d330965f256e587bacb8c to your computer and use it in GitHub Desktop.
dep Container Builder image recipe
# Copyright 2017 Google Inc.
#
# 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
#
# https://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.
# Cloud Build for Go dep image
# gcloud container builds submit --config=cloudbuild.yaml --substitutions=_DEP_COMMIT=master .
steps:
# Clone dep tool
- name: 'gcr.io/cloud-builders/git'
args: ['clone', '-n', 'https://github.com/golang/dep.git', 'src/github.com/golang/dep']
- name: 'gcr.io/cloud-builders/git'
args: ['checkout', '$_DEP_COMMIT']
dir: 'src/github.com/golang/dep'
# Build into image
- name: 'gcr.io/cloud-builders/go:wheezy'
args: ['get', '-v', 'github.com/golang/dep/cmd/dep']
env: ['GOPATH=.']
- name: 'gcr.io/cloud-builders/docker'
args: ['build',
'-t', 'gcr.io/$PROJECT_ID/dep:$BUILD_ID',
'--label', 'DEP_COMMIT=$_DEP_COMMIT',
'-f', 'Dockerfile',
'.']
images:
- 'gcr.io/$PROJECT_ID/dep:$BUILD_ID'
#!/bin/bash
# Copyright 2017 Google Inc.
#
# 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
#
# https://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.
if [ -z "$GOPATH" ]; then
echo "dep: GOPATH must be set" 1>&2
exit 1
fi
export GOPATH="$(readlink -f "$GOPATH")"
/go/bin/dep "$@"
# Copyright 2017 Google Inc.
#
# 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
#
# https://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.
FROM debian:jessie-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
git-core \
mercurial \
subversion \
&& rm -rf /var/lib/apt/lists/*
COPY bin/dep /go/bin/dep
COPY dep.bash /bin/dep.bash
ENTRYPOINT ["/bin/dep.bash"]
@skyl
Copy link

skyl commented Aug 4, 2018

When I try to run the generated container in Google Cloud Builder, I get:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:296: starting container process caused "exec: \"/bin/dep.bash\": permission denied": unknown.

@locona
Copy link

locona commented Sep 3, 2018

maybe
chmod +x dep.bash

@skyl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment