onkarkundargi | 72cfd36 | 2020-02-27 12:34:37 +0530 | [diff] [blame] | 1 | # Copyright 2016 the original author or authors. |
| 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 | # ------------- |
| 16 | # Build stage |
| 17 | |
Scott Baker | f04b639 | 2020-03-20 08:29:46 -0700 | [diff] [blame] | 18 | FROM golang:1.13.8-alpine3.11 AS build-env |
onkarkundargi | 72cfd36 | 2020-02-27 12:34:37 +0530 | [diff] [blame] | 19 | |
| 20 | # Install required packages |
| 21 | RUN apk add --no-cache wget git make build-base protobuf protobuf-dev |
| 22 | |
Scott Baker | f04b639 | 2020-03-20 08:29:46 -0700 | [diff] [blame] | 23 | WORKDIR /go/src |
onkarkundargi | 72cfd36 | 2020-02-27 12:34:37 +0530 | [diff] [blame] | 24 | |
| 25 | COPY . ./ |
| 26 | |
| 27 | ARG org_label_schema_version=unknown |
| 28 | ARG org_label_schema_vcs_url=unknown |
| 29 | ARG org_label_schema_vcs_ref=unknown |
| 30 | ARG org_label_schema_build_date=unknown |
| 31 | ARG org_opencord_vcs_commit_date=unknown |
| 32 | ARG org_opencord_vcs_dirty=unknown |
| 33 | |
| 34 | # Build nem-proxy |
| 35 | SHELL ["/bin/ash", "-o", "pipefail", "-c"] |
Scott Baker | f04b639 | 2020-03-20 08:29:46 -0700 | [diff] [blame] | 36 | RUN go build -mod=vendor -o /build/nem-proxy cmd/nem-ondemand-proxy/main.go |
onkarkundargi | 72cfd36 | 2020-02-27 12:34:37 +0530 | [diff] [blame] | 37 | # ------------- |
| 38 | # Image creation stage |
| 39 | |
| 40 | FROM alpine:3.9.4 |
| 41 | |
| 42 | # Set the working directory |
| 43 | WORKDIR /app |
| 44 | |
| 45 | # Copy required files |
| 46 | COPY --from=build-env /build/nem-proxy /app/ |
| 47 | |
| 48 | # Label image |
| 49 | ARG org_label_schema_version=unknown |
| 50 | ARG org_label_schema_vcs_url=unknown |
| 51 | ARG org_label_schema_vcs_ref=unknown |
| 52 | ARG org_label_schema_build_date=unknown |
| 53 | ARG org_opencord_vcs_commit_date=unknown |
| 54 | ARG org_opencord_vcs_dirty=unknown |
| 55 | |
| 56 | LABEL org.label-schema.schema-version=1.0 \ |
| 57 | org.label-schema.name=nem-proxy \ |
| 58 | org.label-schema.version=$org_label_schema_version \ |
| 59 | org.label-schema.vcs-url=$org_label_schema_vcs_url \ |
| 60 | org.label-schema.vcs-ref=$org_label_schema_vcs_ref \ |
| 61 | org.label-schema.build-date=$org_label_schema_build_date \ |
| 62 | org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date \ |
| 63 | org.opencord.vcs-dirty=$org_opencord_vcs_dirty |
| 64 | |
| 65 | CMD /app/nem-proxy |