Skip to content

Commit

Permalink
Cleanup Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mering committed Jul 12, 2023
1 parent ae9a467 commit ea4242a
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,24 @@
# limitations under the License.

FROM gcr.io/bazel-public/bazel:6.0.0 AS build

USER root
COPY . .
RUN ./cloudbuild.sh build //java/com/google/copybara:copybara_deploy.jar
RUN mkdir -p /tmp/copybara && \
cp bazel-bin/java/com/google/copybara/copybara_deploy.jar /tmp/copybara/
RUN bazel build //java/com/google/copybara:copybara_deploy.jar

USER ubuntu
FROM golang:latest AS buildtools
RUN go install github.com/bazelbuild/buildtools/buildozer@latest
RUN go install github.com/bazelbuild/buildtools/buildifier@latest

FROM openjdk:11-jre-slim
WORKDIR /usr/src/app
ENV COPYBARA_CONFIG=copy.bara.sky \
COPYBARA_SUBCOMMAND=migrate \
COPYBARA_OPTIONS='' \
COPYBARA_WORKFLOW=default \
COPYBARA_SOURCEREF=''
COPY --from=build /tmp/copybara/ /opt/copybara/
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /home/ubuntu/bazel-bin/java/com/google/copybara/copybara_deploy.jar /opt/copybara/
COPY --from=buildtools /go/bin/buildozer /go/bin/buildifier /usr/bin/
ENV COPYBARA_SUBCOMMAND="migrate" \
COPYBARA_CONFIG="copy.bara.sky" \
COPYBARA_WORKFLOW="default" \
COPYBARA_SOURCEREF="" \
COPYBARA_OPTIONS=""
COPY .docker/entrypoint.sh /usr/local/bin/copybara
RUN chmod +x /usr/local/bin/copybara
RUN apt-get update && \
apt-get install -y git && \
apt-get clean
WORKDIR /usr/src/app

0 comments on commit ea4242a

Please sign in to comment.