DevOps Classroom notes 02/June/2026

nopcommerce

ref

Install on ubuntu

sudo add-apt-repository ppa:dotnet/backports

sudo apt-get update

sudo apt-get install -y aspnetcore-runtime-9.0

# validate 
dotnet --list-runtimes

sudo mkdir -p  /var/www/nopCommerce

cd /var/www/nopCommerce

sudo wget https://github.com/nopSolutions/nopCommerce/releases/download/release-4.90.4/nopCommerce_4.90.4_NoSource_linux_x64.zip

sudo apt-get install unzip

sudo unzip nopCommerce_4.90.4_NoSource_linux_x64.zip

sudo mkdir bin
sudo mkdir logs

cd ..
sudo chgrp -R www-data nopCommerce/
sudo chown -R www-data nopCommerce/

sudo tee /etc/systemd/system/nopCommerce.service <<EOF

[Unit]
Description=Example nopCommerce app running on Xubuntu

[Service]
WorkingDirectory=/var/www/nopCommerce
ExecStart=/usr/bin/dotnet /var/www/nopCommerce/Nop.Web.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=nopCommerce-example
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target
EOF


sudo systemctl start nopCommerce.service
sudo systemctl enable nopCommerce.service
sudo systemctl status nopCommerce.service

sudo apt-get install nginx -y 

sudo systemctl start nginx

sudo systemctl status nginx

sudo systemctl enable nginx

# update /etc/nginx/sites-available/default

# Default server configuration
#
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    server_name   nopCommerce.com;

    location / {
    proxy_pass         http://localhost:5000;
    proxy_http_version 1.1;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection keep-alive;
    proxy_set_header   Host $host;
    proxy_cache_bypass $http_upgrade;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Proto $scheme;
    }

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;
}

## restart nginx

sudo systemctl restart nginx

# check endpoint
https://<public ip>

Dockerfile nop

nopcommerce source code


git clone https://github.com/nopSolutions/nopCommerce.git

cd nopCommerce

# create Dockerfile 

## stage 1
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS build

copy . .

# build solution   
RUN dotnet build NopCommerce.sln --no-incremental -c Release

# publish project
WORKDIR /src/Presentation/Nop.Web   
RUN dotnet publish Nop.Web.csproj -c Release -o /app/published

WORKDIR /app/published

RUN mkdir logs bin

RUN chmod 775 App_Data \
    App_Data/DataProtectionKeys \
    bin \
    logs \
    Plugins \
    wwwroot/bundles \
    wwwroot/db_backups \
    wwwroot/files/exportimport \
    wwwroot/icons \
    wwwroot/images \
    wwwroot/images/thumbs \
    wwwroot/images/uploaded \
	wwwroot/sitemaps

FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine AS runtime 

# add globalization support
RUN apk add --no-cache icu-libs icu-data-full
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

# installs required packages
RUN apk add tiff --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/main/ --allow-untrusted
RUN apk add libgdiplus --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/community/ --allow-untrusted
RUN apk add libc-dev tzdata gcompat --no-cache

WORKDIR /app

COPY --from=build /app/published .

ENV ASPNETCORE_URLS=http://+:80
EXPOSE 80
EXPOSE 5000
                            
ENTRYPOINT ["dotnet", "Nop.Web.dll"]


# Stage 1: Download and prepare
FROM debian:bookworm-slim AS prep
WORKDIR /src
RUN apt-get update && apt-get install -y wget unzip \
    && wget https://github.com/nopSolutions/nopCommerce/releases/download/release-4.90.4/nopCommerce_4.90.4_NoSource_linux_x64.zip \
    && unzip nopCommerce_4.90.4_NoSource_linux_x64.zip -d nopCommerce \
    && mkdir -p nopCommerce/bin nopCommerce/logs

# Stage 2: Runtime
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
WORKDIR /app
COPY --from=prep /src/nopCommerce .
ENV ASPNETCORE_URLS=http://+:5000
ENV ASPNETCORE_ENVIRONMENT=Production
ENTRYPOINT ["dotnet", "Nop.Web.dll"]

# Build image
docker build -t nopcommerce:4.90.4 .

# Run container
docker run -d -p 5000:5000 --name nopcommerce nopcommerce:4.90.4

Leave a comment

Turn on JavaScript to leave a comment.

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

Please turn AdBlock off
Social Network Integration by Acurax Social Media Branding Company
Exit mobile version
%%footer%%