Skip to content

Commit

Permalink
Move Dockerfile build paths outside of GOPATH (#3364)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkowl authored Jan 25, 2024
1 parent 51e2628 commit bb3365f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
12 changes: 7 additions & 5 deletions Dockerfile.aro-e2e
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
#
ARG REGISTRY
FROM ${REGISTRY}/ubi8/go-toolset:1.18.10 AS builder
ENV GOOS=linux \
GOPATH=/go/
WORKDIR ${GOPATH}/src/github.com/Azure/ARO-RP

USER root
COPY . ${GOPATH}/src/github.com/Azure/ARO-RP/
ENV GOPATH=/root/go
RUN mkdir -p /app
WORKDIR /app

COPY . /app
RUN make aro RELEASE=${IS_OFFICIAL_RELEASE} -o generate && make e2e.test e2etools

FROM ${REGISTRY}/ubi8/ubi-minimal
RUN microdnf update && microdnf clean all
COPY --from=builder /go/src/github.com/Azure/ARO-RP/aro /go/src/github.com/Azure/ARO-RP/e2e.test /go/src/github.com/Azure/ARO-RP/db /go/src/github.com/Azure/ARO-RP/cluster /go/src/github.com/Azure/ARO-RP/portalauth /go/src/github.com/Azure/ARO-RP/jq /usr/local/bin/
COPY --from=builder /app/aro /app/e2e.test /app/db /app/cluster /app/portalauth /app/jq /usr/local/bin/
ENTRYPOINT ["aro"]
EXPOSE 2222/tcp 8080/tcp 8443/tcp 8444/tcp 8445/tcp
USER 1000
12 changes: 7 additions & 5 deletions Dockerfile.aro-multistage
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
#
ARG REGISTRY
FROM ${REGISTRY}/ubi8/go-toolset:1.18.10 AS builder
ENV GOOS=linux \
GOPATH=/go/
WORKDIR ${GOPATH}/src/github.com/Azure/ARO-RP

USER root
COPY . ${GOPATH}/src/github.com/Azure/ARO-RP/
ENV GOPATH=/root/go
RUN mkdir -p /app
WORKDIR /app

COPY . /app
RUN make aro RELEASE=${IS_OFFICIAL_RELEASE} -o generate && make e2e.test

FROM ${REGISTRY}/ubi8/ubi-minimal
RUN microdnf update && microdnf clean all
COPY --from=builder /go/src/github.com/Azure/ARO-RP/aro /go/src/github.com/Azure/ARO-RP/e2e.test /usr/local/bin/
COPY --from=builder /app/aro /app/e2e.test /usr/local/bin/
ENTRYPOINT ["aro"]
EXPOSE 2222/tcp 8080/tcp 8443/tcp 8444/tcp 8445/tcp
USER 1000
6 changes: 3 additions & 3 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ ARG REGISTRY
FROM ${REGISTRY}/ubi8/go-toolset:1.18.10

USER root
RUN mkdir -p /root/go/src/github.com/Azure/ARO-RP
WORKDIR /root/go/src/github.com/Azure/ARO-RP
ENV GOPATH=/root/go
RUN mkdir -p /app
WORKDIR /app

#we have multiple steps for copy so we can make use of caching
COPY vendor/ vendor
Expand All @@ -22,7 +22,7 @@ COPY pkg/ pkg

#COPY all files with an extension (directories not copied)
COPY ?*.* .
COPY Makefile LICENSE .
COPY Makefile LICENSE ./

COPY .git .git
COPY .gitignore .gitignore
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.proxy
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#
ARG REGISTRY
FROM ${REGISTRY}/ubi8/go-toolset:1.18.10 AS builder
ENV GOOS=linux \
GOPATH=/go/
WORKDIR ${GOPATH}/src/github.com/Azure/ARO-RP
USER root
COPY . ${GOPATH}/src/github.com/Azure/ARO-RP/
ENV GOPATH=/root/go
RUN mkdir -p /app
WORKDIR /app

RUN make proxy

FROM ${REGISTRY}/ubi8/ubi-minimal
Expand Down

0 comments on commit bb3365f

Please sign in to comment.