FROM nginx:1.17.10 as base
# Run updates and install curl package
RUN apt-get update
RUN apt -y install curl
# Remove the default Nginx configuration file
RUN rm -v /etc/nginx/nginx.conf
# Copy a configuration file from the current directory
COPY nginx.conf /etc/nginx/
# Expose ports
EXPOSE 80

#use the yum updated container for the test
FROM base as test
# Copy the test entrypoint script to the container
COPY test_entry_point.sh /usr/local/bin/entry_point.sh
RUN chmod 755 /usr/local/bin/entry_point.sh
# Set the default command to execute
# when creating a new container
ENTRYPOINT  ["/usr/local/bin/entry_point.sh"]

#use the yum updated container to make a proper container
FROM base as deploy
# Copy the entrypoint script to the container
COPY entry_point.sh /usr/local/bin/entry_point.sh
RUN chmod 755 /usr/local/bin/entry_point.sh
# Set the default command to execute
# when creating a new container
ENTRYPOINT  ["/usr/local/bin/entry_point.sh"]
