DevOps Classroom notes 18/Sep/2026

Alpine: most org will be used as a base image

FROM alpine:latest

RUN apk add curl 

refer alpine package versions

FROM alpine:3.21

RUN apk update && apk add curl zip openjdk17-jdk==17.0.18_p8-r0

RUN echo "https://alpinelinux.org(cut -d'.' -f1,2 /etc/alpine-release)/community"

single stage build for nop

FROM ubuntu:latest

ENV ASPNETCORE_ENVIRONMENT=Production
ENV DOTNET_PRINT_TELEMETRY_MESSAGE=false
ENV ASPNETCORE_URLS=http://+:5000
ENV DOTNET_RUNNING_IN_CONTAINER=true
ENV nop_version=4.90.8


RUN apt-get update && \
    apt-get install -y --no-install-recommends software-properties-common wget unzip ca-certificates gnupg && \
    add-apt-repository ppa:dotnet/backports && \
    apt-get update && \
    apt-get install -y --no-install-recommends aspnetcore-runtime-9.0 libgdiplus && \
    rm -rf /var/lib/apt/lists/*

RUN mkdir -p /var/www/nopCommerce

WORKDIR /var/www/nopCommerce

RUN wget https://github.com/nopSolutions/nopCommerce/releases/download/release-${nop_version}/nopCommerce_${nop_version}_NoSource_linux_x64.zip

RUN unzip nopCommerce_${nop_version}_NoSource_linux_x64.zip && rm nopCommerce_${nop_version}_NoSource_linux_x64.zip

RUN mkdir bin logs

RUN chown -R www-data:www-data /var/www/nopCommerce
## sudo chgrp -R www-data nopCommerce/
## sudo chown -R www-data nopCommerce/

USER www-data

EXPOSE 5000
#ENTRYPOINT ["dotnet", "Nop.Web.dll"]
CMD ["dotnet", "Nop.Web.dll"] 

Multi-stage build

############### first stage #####################
FROM ubuntu:latest as fetch-nop

ARG nop_version=4.90.8

RUN apt-get update && apt-get install -y zip wget

WORKDIR app

RUN wget https://github.com/nopSolutions/nopCommerce/releases/download/release-${nop_version}/nopCommerce_${nop_version}_NoSource_linux_x64.zip

RUN unzip nopCommerce_${nop_version}_NoSource_linux_x64.zip && rm nopCommerce_${nop_version}_NoSource_linux_x64.zip

RUN mkdir bin logs

#################### second stage #####################
FROM mcr.microsoft.com/dotnet/sdk:9.0 as second

RUN apt-get update && apt-get install -y curl


##################### Main Stage ########################
FROM mcr.microsoft.com/dotnet/aspnet:9.0-dev

ENV ASPNETCORE_ENVIRONMENT=Production \
    DOTNET_PRINT_TELEMETRY_MESSAGE=false \
    ASPNETCORE_URLS=http://+:5000 \
    DOTNET_RUNNING_IN_CONTAINER=true\
    nop_version=4.90.8

RUN mkdir -p /var/www/nopCommerce

RUN mkdir -p /usr/bin/curl

COPY --from=second /usr/bin/curl /usr/bin/curl
WORKDIR /var/www/nopCommerce

COPY --from=fetch-nop /app .

RUN chown -R www-data:www-data /var/www/nopCommerce

USER www-data

EXPOSE 5000

CMD ["dotnet", "Nop.Web.dll"] 

Multi-stage build

TASK

  1. Create Dockerfile Multi-stage build on stage download html template and second stage copy files to nignx, apache2
  2. Donload templates here
  3. https://www.tooplate.com/zip-templates/2168_sweet_bakery.zip
  4. https://hub.docker.com/_/httpd
FROM httpd:2.4
COPY ./public-html/ /usr/local/apache2/htdocs/

why packages need to copy from another stage

  • some main images will have downlaod packages directly
FROM python:latest as packages
WORKDIR app
RUN pip download -d "/path/to/your/directory" package_name

RUN pip download -d "python_packages" github

FROM Python:no-shell
WORKDIR /usr/local/lib/python3.X/dist-packages/
COPY --form==packages /python_packages .
WORKDIR /app
CMD 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Plugin for Social Media by Acurax Wordpress Design Studio

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube