Run Dockerfile as non-root user
This commit is contained in:
parent
042052e4e5
commit
02a8b86168
1 changed files with 6 additions and 3 deletions
|
|
@ -23,9 +23,12 @@ RUN pip install lndgrpc purerpc
|
||||||
# Production image
|
# Production image
|
||||||
FROM python:3.7-slim as lnbits
|
FROM python:3.7-slim as lnbits
|
||||||
|
|
||||||
|
# Run as non-root
|
||||||
|
USER 1000:1000
|
||||||
|
|
||||||
# Copy over virtualenv
|
# Copy over virtualenv
|
||||||
ENV VIRTUAL_ENV="/opt/venv"
|
ENV VIRTUAL_ENV="/opt/venv"
|
||||||
COPY --from=builder $VIRTUAL_ENV $VIRTUAL_ENV
|
COPY --from=builder --chown=1000:1000 $VIRTUAL_ENV $VIRTUAL_ENV
|
||||||
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||||
|
|
||||||
# Setup Quart
|
# Setup Quart
|
||||||
|
|
@ -38,8 +41,8 @@ ENV LNBITS_BIND="0.0.0.0:5000"
|
||||||
|
|
||||||
# Copy in app source
|
# Copy in app source
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY lnbits /app/lnbits
|
COPY --chown=1000:1000 lnbits /app/lnbits
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
CMD quart assets && quart migrate && hypercorn -k trio --bind $LNBITS_BIND 'lnbits.app:create_app()'
|
CMD quart assets && quart migrate && hypercorn -k trio --bind $LNBITS_BIND 'lnbits.app:create_app()'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue