3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 MAINTAINER Balint Varga <balint.varga@nokia.com>
19 ENV REGISTRY_VERSION=$REGISTRY
20 ARG go_install_dir="/usr/local/go"
23 ENV PATH $go_install_dir/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
25 ENV DOCKER_BUILDTAGS include_oss include_gcs
27 COPY common_scripts/wait-for-files /usr/bin/
30 RUN adduser -u 149 -D -H -s /sbin/nologin dockerreg \
31 && chmod +x /mainstart.sh /usr/bin/wait-for-files \
33 && apk add --no-cache --virtual .build-deps build-base go godep git curl tar bash \
34 && mkdir -p $go_install_dir \
35 && curl -fsSL -k https://dl.google.com/go/go${go_version}.src.tar.gz | tar zx --strip-components=1 -C ${go_install_dir} \
36 && cd ${go_install_dir}/src/ \
38 && mkdir -p ${GOPATH}/src/github.com/docker/distribution \
39 && curl -fsSL -k https://github.com/docker/distribution/archive/v${REGISTRY_VERSION}.tar.gz | tar zx --strip-components=1 -C ${GOPATH}/src/github.com/docker/distribution \
40 && cd ${GOPATH}/src/github.com/docker/distribution \
42 && make PREFIX=/build clean binaries \
43 && mv ${GOPATH}/src/github.com/docker/distribution/bin/registry /usr/bin/ \
45 && apk del .build-deps \
46 && rm -rf $go_install_dir \
50 ENTRYPOINT ["/mainstart.sh"]