Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Dockerfile.tmp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubuntu

# Case-01
CMD ["echo", "hello world"]

# Case-02
# ENTRYPOINT ["echo", "hello world"]

# Case-03
# ENTRYPOINT ["echo"]

# Case-04
# ENTRYPOINT ["echo"]
# CMD ["hello world"]
50 changes: 50 additions & 0 deletions Dockerfile.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
ARG IMAGE_TAG=3.10-slim
FROM python:${IMAGE_TAG}

# Labels for docker image
LABEL maintainer="Anupam Yadav"
LABEL email="anupaminit@gmail.com"

# Arguments for docker file
ARG USERNAME=python
ARG GROUPNAME=$USERNAME
ARG USERID=1100
ARG GROUPID=$USERID

# Environment variable
# Prevents .pyc/__pycache__ creation
ENV PYTHONDONTWRITEBYTECODE=1
# Forces real-time logging/output (no buffering)
ENV PYTHONUNBUFFERED=1

# Check the current user and create a new user
RUN whoami
RUN groupadd --gid $GROUPID $GROUPNAME && useradd --uid $USERID --gid $GROUPID -m $USERNAME

# Install the tools required for the project
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-venv

# Copy requirements file and install all the required python packages
WORKDIR /app
COPY python/requirements.txt /app
# RUN pip3 install --no-cache-dir --break-system-packages -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

COPY python /app

# Change the user to newly created user
USER $USERNAME
RUN whoami

# Expose the container port
EXPOSE 5001

# Change the working directory
WORKDIR /app

# Run the main application file on container startup
ENTRYPOINT ["gunicorn"]
CMD ["--bind", "0.0.0.0:5001", "--workers", "1", "--threads", "8", "main:app"]