chore(jetp): build jetp in an separate stage

Create a multi-stage build to compile jetporch and copy the binary to
nvim image.
This commit is contained in:
Joao P Dubas 2024-01-14 20:11:08 +00:00
parent 98a83f7375
commit cefafaee82

View File

@ -1,3 +1,12 @@
FROM ubuntu:22.04 as jetporch-builder
ENV PATH /root/.cargo/bin:${PATH}
RUN apt-get update \
&& apt-get install -y build-essential curl git libssl-dev pkg-config \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& git clone https://git.sr.ht/~mpdehaan/jetporch /tmp/jetporch \
&& cd /tmp/jetporch \
&& make
FROM ubuntu:22.04 FROM ubuntu:22.04
# system deps # system deps
@ -143,12 +152,10 @@ RUN git clone https://github.com/elixir-lsp/elixir-ls.git ${LOCAL_SRC_HOME}/elix
# command line utilities # command line utilities
RUN curl https://mise.jdx.dev/install.sh | sh \ RUN curl https://mise.jdx.dev/install.sh | sh \
&& curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash \ && curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash \
&& git clone https://github.com/tmux-plugins/tpm.git ${XDG_CONFIG_HOME}/tmux/plugins/tpm \ && git clone https://github.com/tmux-plugins/tpm.git ${XDG_CONFIG_HOME}/tmux/plugins/tpm
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& git clone https://git.sr.ht/~mpdehaan/jetporch ${LOCAL_SRC_HOME}/jetporch \ # fetch jetporch from builder step
&& cd ${LOCAL_SRC_HOME}/jetporch \ COPY --from=jetporch-builder --chown=coder:coder /tmp/jetporch/target/release/jetp ${LOCAL_BIN_HOME}
&& make \
&& ln -s ${LOCAL_SRC_HOME}/jetporch/target/release/jetp ${LOCAL_BIN_HOME}/
# configure fish and bash # configure fish and bash
RUN fish -c true \ RUN fish -c true \