Skip to content

Commit

Permalink
When building docker image, copy tarball at the end to use build cache (
Browse files Browse the repository at this point in the history
apache#5334)

* When building docker image, copy tarball at the end to use build cache

* Install the pulsar python client wheel file after copy the pulsar tarball

* When building docker image, copy tarball at the end to use build cache
  • Loading branch information
merlimat authored Feb 10, 2020
1 parent 4af5223 commit e1f3409
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
19 changes: 11 additions & 8 deletions docker/pulsar-standalone/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ FROM apachepulsar/pulsar-dashboard:latest as dashboard
# Restart from
FROM openjdk:8-jdk

# Copy pulsar files from pulsar-all
COPY --from=pulsar /pulsar /pulsar

# Copy dashboard files from pulsar-dashboard
COPY --from=dashboard /pulsar/django /pulsar/django
COPY --from=dashboard /pulsar/requirements.txt /pulsar/django
COPY --from=dashboard /pulsar/conf/* /pulsar/conf/

# Note that the libpq-dev package is needed here in order to install
# the required python psycopg2 package (for postgresql) later
RUN apt-get update
Expand All @@ -59,6 +51,17 @@ redirect_stderr=true" >> /etc/supervisor/conf.d/supervisor-app.conf
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
COPY --from=dashboard /etc/nginx/sites-available/default /etc/nginx/sites-available/default

# Copy pulsar files from pulsar-all
COPY --from=pulsar /pulsar /pulsar

# Copy web-app sources
COPY . /pulsar/

# Copy dashboard files from pulsar-dashboard
COPY --from=dashboard /pulsar/django /pulsar/django
COPY --from=dashboard /pulsar/requirements.txt /pulsar/django
COPY --from=dashboard /pulsar/conf/* /pulsar/conf/

# Copy web-app sources
# Setup database and create tables
COPY --from=dashboard /pulsar/init-postgres.sh /pulsar/django/init-postgres.sh
Expand Down
13 changes: 8 additions & 5 deletions docker/pulsar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ COPY scripts/install-pulsar-client-37.sh /pulsar/bin
### and add Python dependencies (for Pulsar functions)

FROM openjdk:8-jdk-slim
COPY --from=pulsar /pulsar /pulsar

# Install some utilities
RUN apt-get update \
Expand All @@ -57,16 +56,20 @@ RUN python3.7 get-pip.py

ADD target/python-client/ /pulsar/pulsar-client
ADD target/cpp-client/ /pulsar/cpp-client
RUN /pulsar/bin/install-pulsar-client-27.sh
RUN /pulsar/bin/install-pulsar-client-37.sh
RUN echo networkaddress.cache.ttl=1 >> $JAVA_HOME/jre/lib/security/java.security
RUN apt-get update \
&& apt install -y /pulsar/cpp-client/*.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /pulsar

VOLUME ["/pulsar/conf", "/pulsar/data"]

ENV PULSAR_ROOT_LOGGER=INFO,CONSOLE


COPY --from=pulsar /pulsar /pulsar
WORKDIR /pulsar

RUN /pulsar/bin/install-pulsar-client-27.sh
RUN /pulsar/bin/install-pulsar-client-37.sh

0 comments on commit e1f3409

Please sign in to comment.