You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by Andy Grove <an...@gmail.com> on 2022/09/17 20:07:15 UTC

Request for help with node/yarn in Docker image

The Ballista project had a scheduler UI contributed a while back [1], and I
can get this working locally but am running into errors when trying to
build this in a Docker image along with the Rust scheduler process. I have
zero experience with node/yarn, so am wondering if anyone could spare some
time to help point me in the right direction.

I have a PR up with a comment where I am stuck. [2]

Thanks,

Andy.

[1]
https://github.com/apache/arrow-ballista/commit/372ba5fadf3c6c645b98185589996c849e42aac5
[2] https://github.com/apache/arrow-ballista/pull/238

Re: Request for help with node/yarn in Docker image

Posted by Andy Grove <an...@gmail.com>.
Thanks, Gavin! That is a huge help.

On Sat, Sep 17, 2022 at 7:49 PM Gavin Ray <ra...@gmail.com> wrote:

> (I omitted the part where you'd need to run the "apt-get install nginx"
> above in last, single-file Docker build, whoops)
>
> That would of course go after the "COPY --from=ui-build" and before the
> CMD/ENTRYPOINT 👍
>
> On Sat, Sep 17, 2022 at 9:46 PM Gavin Ray <ra...@gmail.com> wrote:
>
>> Hey Andy,
>>
>> Happy to be useful in some way, I have a fair amount of experience here.
>>
>> Since you already have a Dockerfile next to this one that is building the
>> React app and serving it on NGINX:
>> "/workspaces/arrow-ballista/dev/docker/ballista-scheduler-ui.dockerfile"
>>
>> You can just copy the built assets out of it:
>>
>> ARG VERSION
>> FROM apache/arrow-ballista:$VERSION
>> COPY --from=ballista-scheduler-ui:0.8.0 /usr/share/nginx/html
>> /usr/share/nginx/html
>>
>> # TODO start nginx in background to serve the UI
>>
>> ENV RUST_LOG=info
>> ENV RUST_BACKTRACE=full
>>
>> CMD ["/scheduler", "&&", "nginx", "-g", "daemon off;"]
>>
>> That run command is probably wrong, you'd want to use a shell script that
>> does both things with ENTRYPOINT, not CMD but you get the point
>> It seems to build anyways:
>>
>> [image: image.png]
>>
>> If you want to have it in a single step, you can rewrite the Dockerfile
>> like this:
>> ARG VERSION
>>
>> FROM node:18-alpine as ui-build
>> WORKDIR /app
>> ENV PATH /app/node_modules/.bin:$PATH
>>
>> COPY package.json ./
>> COPY yarn.lock ./
>> RUN yarn
>>
>> COPY . ./
>> RUN yarn build
>>
>> FROM apache/arrow-ballista:$VERSION
>> COPY --from=ui-build /app/build /usr/share/nginx/html
>>
>> # TODO start nginx in background to serve the UI
>> ENV RUST_LOG=info
>> ENV RUST_BACKTRACE=full
>>
>> CMD ["/scheduler", "&&", "nginx", "-g", "daemon off;"]
>>
>> On Sat, Sep 17, 2022 at 4:07 PM Andy Grove <an...@gmail.com> wrote:
>>
>>> The Ballista project had a scheduler UI contributed a while back [1],
>>> and I
>>> can get this working locally but am running into errors when trying to
>>> build this in a Docker image along with the Rust scheduler process. I
>>> have
>>> zero experience with node/yarn, so am wondering if anyone could spare
>>> some
>>> time to help point me in the right direction.
>>>
>>> I have a PR up with a comment where I am stuck. [2]
>>>
>>> Thanks,
>>>
>>> Andy.
>>>
>>> [1]
>>>
>>> https://github.com/apache/arrow-ballista/commit/372ba5fadf3c6c645b98185589996c849e42aac5
>>> [2] https://github.com/apache/arrow-ballista/pull/238
>>>
>>

Re: Request for help with node/yarn in Docker image

Posted by Gavin Ray <ra...@gmail.com>.
(I omitted the part where you'd need to run the "apt-get install nginx"
above in last, single-file Docker build, whoops)

That would of course go after the "COPY --from=ui-build" and before the
CMD/ENTRYPOINT 👍

On Sat, Sep 17, 2022 at 9:46 PM Gavin Ray <ra...@gmail.com> wrote:

> Hey Andy,
>
> Happy to be useful in some way, I have a fair amount of experience here.
>
> Since you already have a Dockerfile next to this one that is building the
> React app and serving it on NGINX:
> "/workspaces/arrow-ballista/dev/docker/ballista-scheduler-ui.dockerfile"
>
> You can just copy the built assets out of it:
>
> ARG VERSION
> FROM apache/arrow-ballista:$VERSION
> COPY --from=ballista-scheduler-ui:0.8.0 /usr/share/nginx/html
> /usr/share/nginx/html
>
> # TODO start nginx in background to serve the UI
>
> ENV RUST_LOG=info
> ENV RUST_BACKTRACE=full
>
> CMD ["/scheduler", "&&", "nginx", "-g", "daemon off;"]
>
> That run command is probably wrong, you'd want to use a shell script that
> does both things with ENTRYPOINT, not CMD but you get the point
> It seems to build anyways:
>
> [image: image.png]
>
> If you want to have it in a single step, you can rewrite the Dockerfile
> like this:
> ARG VERSION
>
> FROM node:18-alpine as ui-build
> WORKDIR /app
> ENV PATH /app/node_modules/.bin:$PATH
>
> COPY package.json ./
> COPY yarn.lock ./
> RUN yarn
>
> COPY . ./
> RUN yarn build
>
> FROM apache/arrow-ballista:$VERSION
> COPY --from=ui-build /app/build /usr/share/nginx/html
>
> # TODO start nginx in background to serve the UI
> ENV RUST_LOG=info
> ENV RUST_BACKTRACE=full
>
> CMD ["/scheduler", "&&", "nginx", "-g", "daemon off;"]
>
> On Sat, Sep 17, 2022 at 4:07 PM Andy Grove <an...@gmail.com> wrote:
>
>> The Ballista project had a scheduler UI contributed a while back [1], and
>> I
>> can get this working locally but am running into errors when trying to
>> build this in a Docker image along with the Rust scheduler process. I have
>> zero experience with node/yarn, so am wondering if anyone could spare some
>> time to help point me in the right direction.
>>
>> I have a PR up with a comment where I am stuck. [2]
>>
>> Thanks,
>>
>> Andy.
>>
>> [1]
>>
>> https://github.com/apache/arrow-ballista/commit/372ba5fadf3c6c645b98185589996c849e42aac5
>> [2] https://github.com/apache/arrow-ballista/pull/238
>>
>

Re: Request for help with node/yarn in Docker image

Posted by Gavin Ray <ra...@gmail.com>.
Hey Andy,

Happy to be useful in some way, I have a fair amount of experience here.

Since you already have a Dockerfile next to this one that is building the
React app and serving it on NGINX:
"/workspaces/arrow-ballista/dev/docker/ballista-scheduler-ui.dockerfile"

You can just copy the built assets out of it:

ARG VERSION
FROM apache/arrow-ballista:$VERSION
COPY --from=ballista-scheduler-ui:0.8.0 /usr/share/nginx/html
/usr/share/nginx/html

# TODO start nginx in background to serve the UI

ENV RUST_LOG=info
ENV RUST_BACKTRACE=full

CMD ["/scheduler", "&&", "nginx", "-g", "daemon off;"]

That run command is probably wrong, you'd want to use a shell script that
does both things with ENTRYPOINT, not CMD but you get the point
It seems to build anyways:

[image: image.png]

If you want to have it in a single step, you can rewrite the Dockerfile
like this:
ARG VERSION

FROM node:18-alpine as ui-build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH

COPY package.json ./
COPY yarn.lock ./
RUN yarn

COPY . ./
RUN yarn build

FROM apache/arrow-ballista:$VERSION
COPY --from=ui-build /app/build /usr/share/nginx/html

# TODO start nginx in background to serve the UI
ENV RUST_LOG=info
ENV RUST_BACKTRACE=full

CMD ["/scheduler", "&&", "nginx", "-g", "daemon off;"]

On Sat, Sep 17, 2022 at 4:07 PM Andy Grove <an...@gmail.com> wrote:

> The Ballista project had a scheduler UI contributed a while back [1], and I
> can get this working locally but am running into errors when trying to
> build this in a Docker image along with the Rust scheduler process. I have
> zero experience with node/yarn, so am wondering if anyone could spare some
> time to help point me in the right direction.
>
> I have a PR up with a comment where I am stuck. [2]
>
> Thanks,
>
> Andy.
>
> [1]
>
> https://github.com/apache/arrow-ballista/commit/372ba5fadf3c6c645b98185589996c849e42aac5
> [2] https://github.com/apache/arrow-ballista/pull/238
>