create docker file for nopCommerce
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
ENV aspnetcore=9.0
# RUN apt-get update && add-apt-repository ppa:dotnet/backports
# RUN apt-get update
# RUN apt-get install -y aspnetcore-runtime-9.0
# RUN dotnet --list-runtimes
# RUN apt-get install -y wget unzip
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"]
docker build -t nop:1.0
docker network create nopnet
docker run -dit --name nop --network nopnet -p 5000:5000 nop:1.0
run mysql
docker run -dit --name mysql-container \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
--network nopnet \
-p 3306:3306 \
-v mysql-data:/var/lib/mysql \
-d mysql:8.0
open ports in vm
next configure mysql nop application
- select database mysql
- select connection string
Example:
Data Source=sqlServerName;Initial Catalog=dbName;Persist Security Info=True;User ID=root;Password=my-secret-pw
# replace localhost with ipaddress
Data Source=localhost;Port=3306;Initial Catalog=mysql;User ID=root;Password=my-secret-pw;