Skip to content

Commit

Permalink
Merge pull request #5 from mbari-org/lighter_image
Browse files Browse the repository at this point in the history
Lighter image
  • Loading branch information
kevinsbarnard authored Sep 12, 2023
2 parents a741e85 + 030a162 commit d27999f
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10-slim-buster
FROM python:3.10-slim-buster as builder
ENV DEBIAN_FRONTEND=noninteractive

# Install dependencies
Expand All @@ -7,9 +7,8 @@ RUN apt update && \
rm -rf /var/lib/apt/lists/*

# Clone, build, and install LCM
RUN git clone https://github.com/lcm-proj/lcm.git && \
RUN git clone --depth=1 --branch=v1.5.0 https://github.com/lcm-proj/lcm.git && \
cd lcm && \
git checkout v1.5.0 && \
mkdir build && \
cd build && \
cmake \
Expand All @@ -30,9 +29,29 @@ RUN pip install poetry
COPY . /app
WORKDIR /app

# Build and install lcm-websocket-server
# Build lcm_websocket_server*.whl
RUN poetry build
RUN pip install dist/*.whl

FROM python:3.10-slim-buster

# pkg-config seems still needed
RUN apt update && \
apt install -y --no-install-recommends pkg-config && \
rm -rf /var/lib/apt/lists/*

# Copy lcm artifacts:
COPY --from=builder /usr/local/lib/liblcm* /usr/local/lib/
COPY --from=builder /usr/local/lib/lcm /usr/local/lib/lcm
COPY --from=builder /usr/local/lib/pkgconfig/lcm.pc /usr/local/lib/pkgconfig/
COPY --from=builder /usr/local/include/lcm /usr/local/include/lcm
COPY --from=builder /usr/local/share/aclocal /usr/local/share/aclocal
# lcm python bindings:
COPY --from=builder /usr/local/lib/python3.10/site-packages/lcm /usr/local/lib/python3.10/site-packages/lcm

# Install lcm-websocket-server:
COPY --from=builder /app/dist/*.whl /tmp/
RUN pip install /tmp/*.whl && \
rm -rf /tmp/*.whl

ENV HOST=0.0.0.0
ENV PORT=8765
Expand Down

0 comments on commit d27999f

Please sign in to comment.