80cc4dc1729aafe1d28b2552b3f7765de53184b0
[ta/caas-registry.git] / docker-build / registry / Dockerfile
1 # Copyright 2019 Nokia
2 #
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
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
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.
14
15 FROM alpine:3.9
16 MAINTAINER Balint Varga <balint.varga@nokia.com>
17
18 ARG REGISTRY
19 ENV REGISTRY_VERSION=$REGISTRY
20 ENV GOPATH /build
21 ENV PATH /usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
22
23 ENV DOCKER_BUILDTAGS include_oss include_gcs
24
25 WORKDIR ${GOPATH}/src/github.com/docker/distribution
26 COPY common_scripts/wait-for-files /usr/bin/
27 COPY mainstart.sh /
28
29 RUN adduser -u 149 -D -H -s /sbin/nologin dockerreg \
30 &&  chmod +x /mainstart.sh /usr/bin/wait-for-files \
31 \
32 &&  apk add --no-cache --virtual .build-deps build-base go godep git curl tar \
33 &&  curl -fsSL -k https://github.com/docker/distribution/archive/v${REGISTRY_VERSION}.tar.gz | tar zx --strip-components=1 \
34 &&  go get -d -v \
35 &&  make PREFIX=/build clean binaries \
36 &&  mv ${GOPATH}/src/github.com/docker/distribution/bin/registry /usr/bin/ \
37 \
38 &&  apk del .build-deps \
39 &&  rm -rf /build
40
41 WORKDIR /
42 ENTRYPOINT ["/mainstart.sh"]