Skip to content

Commit

Permalink
🐳 fix Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: vankichi <[email protected]>
  • Loading branch information
vankichi committed Sep 27, 2023
1 parent 9433449 commit 014818c
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 62 deletions.
25 changes: 11 additions & 14 deletions dockers/tools/benchmark/job/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

ARG GO_VERSION=latest
ARG DISTROLESS_IMAGE=gcr.io/distroless/static
ARG DISTROLESS_IMAGE_TAG=nonroot
ARG UPX_OPTIONS=-9
ARG MAINTAINER="vdaas.org vald team <[email protected]>"

FROM golang:${GO_VERSION} AS golang

FROM ubuntu:devel AS builder

ARG UPX_OPTIONS
Expand Down Expand Up @@ -47,17 +50,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p ${GOPATH}/src

COPY --from=golang /usr/local/go $GOROOT
RUN mkdir -p "$GOPATH/src"

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/Makefile.d
COPY Makefile.d .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
COPY Makefile .
COPY .git .
COPY go.mod .
COPY go.sum .

RUN go mod download
RUN make go/download

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/internal
COPY internal .
Expand All @@ -74,22 +79,15 @@ COPY cmd/${PKG} .
WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/versions
COPY versions .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/Makefile.d
COPY Makefile.d .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
COPY Makefile .

COPY .git .

RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
&& upx ${UPX_OPTIONS} -o "/usr/bin/${APP_NAME}" "cmd/${PKG}/${APP_NAME}"
&& mv "cmd/${PKG}/${APP_NAME}" "/usr/bin/${APP_NAME}"

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/cmd/${PKG}
RUN cp sample.yaml /tmp/config.yaml

FROM ${DISTROLESS_IMAGE}:${DISTROLESS_IMAGE_TAG}
LABEL maintainer "Vald team <[email protected]>"
LABEL maintainer="${MAINTAINER}"
ENV APP_NAME job

COPY --from=builder /usr/lib/x86_64-linux-gnu/libaec* /usr/lib/x86_64-linux-gnu/
Expand Down Expand Up @@ -131,7 +129,6 @@ COPY --from=builder /lib/x86_64-linux-gnu/libtasn1.so.6 /lib/x86_64-linux-gnu/
COPY --from=builder /lib/x86_64-linux-gnu/libkeyutils.so.1 /lib/x86_64-linux-gnu/
COPY --from=builder /lib/x86_64-linux-gnu/libresolv.so.2 /lib/x86_64-linux-gnu/
COPY --from=builder /lib/x86_64-linux-gnu/libffi.so.8 /lib/x86_64-linux-gnu/
# COPY --from=builder /lib/x86_64-linux-gnu/ /lib/x86_64-linux-gnu/
COPY --from=builder /lib64/ld-linux-x86-64.so.2 /lib64/

COPY --from=builder /usr/bin/${APP_NAME} /go/bin/${APP_NAME}
Expand Down
19 changes: 9 additions & 10 deletions dockers/tools/benchmark/operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ ARG DISTROLESS_IMAGE_TAG=nonroot
ARG UPX_OPTIONS=-9
ARG MAINTAINER="vdaas.org vald team <[email protected]>"

FROM golang:${GO_VERSION} AS golang

FROM ubuntu:devel AS builder

ENV GO111MODULE on
Expand Down Expand Up @@ -50,8 +52,12 @@ RUN mkdir -p ${GOPATH}/src
COPY --from=golang /usr/local/go $GOROOT
RUN mkdir -p "$GOPATH/src"

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/Makefile.d
COPY Makefile.d .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
COPY Makefile .
COPY .git .
COPY go.mod .
COPY go.sum .

Expand All @@ -72,22 +78,15 @@ COPY cmd/${PKG} .
WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/versions
COPY versions .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/Makefile.d
COPY Makefile.d .

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}
COPY Makefile .

COPY .git .

RUN make REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \
&& upx ${UPX_OPTIONS} -o "/usr/bin/${APP_NAME}" "cmd/${PKG}/${APP_NAME}"
&& mv "cmd/${PKG}/${APP_NAME}" "/usr/bin/${APP_NAME}"

WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/cmd/${PKG}
RUN cp sample.yaml /tmp/config.yaml

FROM ${DISTROLESS_IMAGE}:${DISTROLESS_IMAGE_TAG}
LABEL maintainer "Vald team <[email protected]>"
LABEL maintainer="${MAINTAINER}"
ENV APP_NAME operator

COPY --from=builder /usr/bin/${APP_NAME} /go/bin/${APP_NAME}
Expand Down
28 changes: 14 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ replace (
github.com/ajstarks/svgo => github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b
github.com/antihax/optional => github.com/antihax/optional v1.0.0
github.com/armon/go-socks5 => github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
github.com/aws/aws-sdk-go => github.com/aws/aws-sdk-go v1.45.14
github.com/aws/aws-sdk-go => github.com/aws/aws-sdk-go v1.45.15
github.com/aws/aws-sdk-go-v2 => github.com/aws/aws-sdk-go-v2 v1.21.0
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream => github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13
github.com/aws/aws-sdk-go-v2/config => github.com/aws/aws-sdk-go-v2/config v1.18.41
github.com/aws/aws-sdk-go-v2/credentials => github.com/aws/aws-sdk-go-v2/credentials v1.13.39
github.com/aws/aws-sdk-go-v2/config => github.com/aws/aws-sdk-go-v2/config v1.18.42
github.com/aws/aws-sdk-go-v2/credentials => github.com/aws/aws-sdk-go-v2/credentials v1.13.40
github.com/aws/aws-sdk-go-v2/feature/ec2/imds => github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11
github.com/aws/aws-sdk-go-v2/feature/s3/manager => github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.85
github.com/aws/aws-sdk-go-v2/feature/s3/manager => github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.86
github.com/aws/aws-sdk-go-v2/internal/configsources => github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 => github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35
github.com/aws/aws-sdk-go-v2/internal/ini => github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42
github.com/aws/aws-sdk-go-v2/internal/ini => github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding => github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14
github.com/aws/aws-sdk-go-v2/service/internal/checksum => github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url => github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35
Expand All @@ -63,7 +63,7 @@ replace (
github.com/aws/aws-sdk-go-v2/service/sns => github.com/aws/aws-sdk-go-v2/service/sns v1.22.0
github.com/aws/aws-sdk-go-v2/service/sqs => github.com/aws/aws-sdk-go-v2/service/sqs v1.24.5
github.com/aws/aws-sdk-go-v2/service/ssm => github.com/aws/aws-sdk-go-v2/service/ssm v1.37.5
github.com/aws/aws-sdk-go-v2/service/sso => github.com/aws/aws-sdk-go-v2/service/sso v1.14.0
github.com/aws/aws-sdk-go-v2/service/sso => github.com/aws/aws-sdk-go-v2/service/sso v1.14.1
github.com/aws/aws-sdk-go-v2/service/sts => github.com/aws/aws-sdk-go-v2/service/sts v1.22.0
github.com/aws/smithy-go => github.com/aws/smithy-go v1.14.2
github.com/benbjohnson/clock => github.com/benbjohnson/clock v1.3.5
Expand Down Expand Up @@ -146,7 +146,7 @@ replace (
github.com/golang/protobuf => github.com/golang/protobuf v1.5.3
github.com/golang/snappy => github.com/golang/snappy v0.0.4
github.com/google/btree => github.com/google/btree v1.1.2
github.com/google/gnostic => github.com/google/gnostic v0.6.9
github.com/google/gnostic => github.com/google/gnostic v0.7.0
github.com/google/go-cmp => github.com/google/go-cmp v0.5.9
github.com/google/go-replayers/grpcreplay => github.com/google/go-replayers/grpcreplay v1.1.0
github.com/google/go-replayers/httpreplay => github.com/google/go-replayers/httpreplay v1.2.0
Expand Down Expand Up @@ -237,7 +237,7 @@ replace (
github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.16.0
github.com/prometheus/client_model => github.com/prometheus/client_model v0.4.0
github.com/prometheus/common => github.com/prometheus/common v0.44.0
github.com/prometheus/procfs => github.com/prometheus/procfs v0.11.1
github.com/prometheus/procfs => github.com/prometheus/procfs v0.12.0
github.com/prometheus/prometheus => github.com/prometheus/prometheus v1.99.0
github.com/quasilyte/go-ruleguard => github.com/quasilyte/go-ruleguard v0.4.0
github.com/quasilyte/go-ruleguard/dsl => github.com/quasilyte/go-ruleguard/dsl v0.3.22
Expand All @@ -257,7 +257,7 @@ replace (
github.com/shurcooL/httpfs => github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c
github.com/shurcooL/vfsgen => github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92
github.com/sirupsen/logrus => github.com/sirupsen/logrus v1.9.3
github.com/spf13/afero => github.com/spf13/afero v1.9.5
github.com/spf13/afero => github.com/spf13/afero v1.10.0
github.com/spf13/cobra => github.com/spf13/cobra v1.7.0
github.com/spf13/pflag => github.com/spf13/pflag v1.0.5
github.com/stoewer/go-strcase => github.com/stoewer/go-strcase v1.3.0
Expand All @@ -284,7 +284,7 @@ replace (
go.opentelemetry.io/otel/sdk/metric => go.opentelemetry.io/otel/sdk/metric v0.33.0
go.opentelemetry.io/otel/trace => go.opentelemetry.io/otel/trace v1.11.1
go.opentelemetry.io/proto/otlp => go.opentelemetry.io/proto/otlp v1.0.0
go.starlark.net => go.starlark.net v0.0.0-20230912135651-745481cf39ed
go.starlark.net => go.starlark.net v0.0.0-20230921161717-a9587466d7a5
go.uber.org/atomic => go.uber.org/atomic v1.11.0
go.uber.org/automaxprocs => go.uber.org/automaxprocs v1.5.3
go.uber.org/goleak => go.uber.org/goleak v1.2.1
Expand All @@ -296,7 +296,7 @@ replace (
golang.org/x/exp/typeparams => golang.org/x/exp/typeparams v0.0.0-20230905200255-921286631fa9
golang.org/x/image => golang.org/x/image v0.12.0
golang.org/x/lint => golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/mobile => golang.org/x/mobile v0.0.0-20230906132913-2077a3224571
golang.org/x/mobile => golang.org/x/mobile v0.0.0-20230922142353-e2f452493d57
golang.org/x/mod => golang.org/x/mod v0.12.0
golang.org/x/net => golang.org/x/net v0.15.0
golang.org/x/oauth2 => golang.org/x/oauth2 v0.12.0
Expand All @@ -316,7 +316,7 @@ replace (
google.golang.org/genproto => google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13
google.golang.org/genproto/googleapis/api => google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13
google.golang.org/genproto/googleapis/rpc => google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13
google.golang.org/grpc => google.golang.org/grpc v1.58.1
google.golang.org/grpc => google.golang.org/grpc v1.58.2
google.golang.org/grpc/cmd/protoc-gen-go-grpc => google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
google.golang.org/protobuf => google.golang.org/protobuf v1.31.0
gopkg.in/check.v1 => gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
Expand Down Expand Up @@ -394,8 +394,8 @@ require (
golang.org/x/sync v0.3.0
golang.org/x/sys v0.12.0
golang.org/x/text v0.13.0
golang.org/x/tools v0.13.0
golang.org/x/time v0.3.0
golang.org/x/tools v0.13.0
gonum.org/v1/hdf5 v0.0.0-00010101000000-000000000000
gonum.org/v1/plot v0.10.1
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb
Expand Down Expand Up @@ -449,6 +449,7 @@ require (
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
Expand Down Expand Up @@ -498,7 +499,6 @@ require (
golang.org/x/image v0.12.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/term v0.12.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
google.golang.org/api v0.134.0 // indirect
Expand Down
Loading

0 comments on commit 014818c

Please sign in to comment.