Skip to content

Instantly share code, notes, and snippets.

@iloveicedgreentea
Created November 10, 2020 22:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iloveicedgreentea/feecd7d47185b36caad58fed87fe4e41 to your computer and use it in GitHub Desktop.
Save iloveicedgreentea/feecd7d47185b36caad58fed87fe4e41 to your computer and use it in GitHub Desktop.
example2
FROM python:3.8-slim
# Update and install deps. Install packages the app needs and remove list cache to save space. Notice this is done in one layer
RUN apt-get update && apt-get upgrade -y && \
apt-get install zip unzip -y && \
rm -rf /var/lib/apt/lists/*
# Set a home directory specifically for this container
ENV WORKDIR="/app"
# Create the user, our app directory, and set the owner
RUN useradd -s /bin/bash --no-create-home app && mkdir -p ${WORKDIR} && chown -R app:app ${WORKDIR}
# run as app user
USER app
# set our relative directory to /app
WORKDIR ${WORKDIR}
# Copy app files
COPY --chown=app:app src/* ${WORKDIR}/
# Set an entrypoint and cmd
ENTRYPOINT [ "some entrypoint script" ]
CMD [ "command to start" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment