Skip to content

Instantly share code, notes, and snippets.

@johanvanderkuijl
Created November 17, 2021 10:38
Show Gist options
  • Save johanvanderkuijl/23ee955607c0754460cd800933c370e2 to your computer and use it in GitHub Desktop.
Save johanvanderkuijl/23ee955607c0754460cd800933c370e2 to your computer and use it in GitHub Desktop.
#FROM python:3.7.0-alpine3.8
FROM python:3.7.1-stretch
# Create user that will be used in this image
RUN groupadd -g 1000 appuser && \
useradd -r -u 1000 -g appuser appuser
# Install tools
RUN apt-get update \
&& apt-get -y install unzip \
&& apt-get -y install libaio-dev \
&& mkdir -p /opt/data/api
WORKDIR /usr/src/app
# Install Oracle instanclient and dependencies
COPY ./oracle-instantclient/ .
COPY ./install-instantclient.sh .
ENV ORACLE_HOME=/opt/oracle/instantclient
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME
ENV OCI_HOME=/opt/oracle/instantclient
ENV OCI_LIB_DIR=/opt/oracle/instantclient
ENV OCI_INCLUDE_DIR=/opt/oracle/instantclient/sdk/include
RUN chmod +x install-instantclient.sh
RUN ./install-instantclient.sh
# Install python libraries
COPY ./requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# HEALTHCHECK --interval=30s --timeout=3s --start-period=10s \
# CMD curl -f http://localhost:5000/ || exit 1
# the container will be run as this user
USER appuser
# Install the webserver and testscript by copying the api directory
COPY ./api ./api
EXPOSE 5000
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "5000"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment