Skip to content

Commit

Permalink
fix(controller): error loading shared library
Browse files Browse the repository at this point in the history
  • Loading branch information
duanhongyi committed Sep 2, 2021
1 parent ba0b69d commit 47d438d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
11 changes: 6 additions & 5 deletions rootfs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@ FROM docker.io/library/python:3.9-alpine

COPY requirements.txt /app/requirements.txt

ENV PATH="/app/.venv/bin:${PATH}"

RUN apk add --update --virtual .build-deps \
postgresql-dev \
gcc \
rust \
cargo \
postgresql-dev \
libffi-dev \
musl-dev \
openssl-dev \
&& python3 -m venv /app/.venv \
&& source /app/.venv/bin/activate \
&& pip3 install --disable-pip-version-check --no-cache-dir -r /app/requirements.txt \
&& runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
scanelf --needed --nobanner --format '%n#p' --recursive /app/.venv \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| awk 'system("[ -e /app/.venv/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)" \
&& apk add --update --virtual .controller-rundeps \
$runDeps \
Expand All @@ -30,6 +29,8 @@ RUN apk add --update --virtual .build-deps \

COPY . /app

ENTRYPOINT ["/app/bin/entrypoint"]

WORKDIR /app
CMD ["/app/bin/boot"]
EXPOSE 8000
11 changes: 7 additions & 4 deletions rootfs/Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ ENV PATH="/app/.venv/bin:${PATH}"

RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >>/etc/apk/repositories \
&& apk add --update --virtual .build-deps \
postgresql-dev \
gcc \
rust \
cargo \
postgresql-dev \
libffi-dev \
musl-dev \
openldap-dev \
openssl-dev \
&& python3 -m venv /app/.venv \
&& source /app/.venv/bin/activate \
&& pip3 install --disable-pip-version-check --no-cache-dir -r /app/requirements.txt \
&& pip3 install --disable-pip-version-check --no-cache-dir -r /app/dev_requirements.txt \
&& runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
scanelf --needed --nobanner --format '%n#p' --recursive /app/.venv \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
| awk 'system("[ -e /app/.venv/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)" \
&& apk add --update --virtual .controller-rundeps \
$runDeps \
Expand All @@ -43,6 +44,8 @@ RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >>/etc/apk/repositor

COPY . /app

ENTRYPOINT ["/app/bin/entrypoint"]

WORKDIR /app
CMD ["/app/bin/boot"]
EXPOSE 8000
6 changes: 6 additions & 0 deletions rootfs/bin/entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
# shellcheck disable=SC1090,SC1091

set -e
source /app/.venv/bin/activate
exec "$@"

0 comments on commit 47d438d

Please sign in to comment.