03. Copying an Application

Copying An Application

ND9991 C04 L03 A03 Copying An Application

Make sure to add the additional line to your Dockerfile before moving on!

COPY . nlib /app/

The updated Dockerfile should look like this:

FROM python:3.7.3-stretch

# Working Directory
WORKDIR /app

# Copy source code to working directory
COPY . flask_app/web.py /app/
COPY . nlib /app/

# Install packages from requirements.txt
# hadolint ignore=DL3013
RUN pip install --upgrade pip &&\
    pip install --trusted-host pypi.python.org -r requirements.txt

# Expose port 80
EXPOSE 80

# Run app.py at container launch
CMD ["python", "web.py"]

Copying An Application

What is an important step to consider when copying an application to Docker?

SOLUTION:
  • Libraries may need to be installed
  • It is important to have a way to test the application
  • Understanding which port to expose from the container
  • Understanding which port to expose from the host