Software prerequisites
Installed Docker or Docker Desktop
Ability to run shell scripts
Let's say we want to use the Smartstore Community Edition Docker Image, but have a self-developed or thirdparty plugin that we also want to use. How do we get the new plugin into the Docker image?
The example is run under Windows, but it will be similar under Linux.
Download the Community Edition
We download the release of the Community Edition from GitHub. It is important that the versions of the release and the plugin are the identical.
For the Docker image we need the Linux release of Smartstore.
After downloading, we unpack the contents of the file Smartstore.Community.5.0.1.linux-x64.zip
(newer versions will have a different name) into a subfolder. The name is not relevant, I simply named the folder build_my_docker_image
.
We place our own or thiry-party plugin in the \Modules
folder. Not as a zip file, but unpacked.
Now we need the Dockerfile and the script file with the instructions for creating the Docker image. We create an empty text file in the build_my_docker_image folder with the file name Dockerfile (without an extension, simply Dockerfile).
We create an empty text file in the build_my_docker_image
folder with the file name Dockerfile
(without an extension, just Dockerfile), copy the following content into it and save the file.
# ----------------------------------------------------------- # Creates a Docker image from an existing build artifact # ----------------------------------------------------------- ARG ASPNET_TAG=7.0 FROM mcr.microsoft.com/dotnet/aspnet:${ASPNET_TAG} EXPOSE 80 EXPOSE 443 ENV ASPNETCORE_URLS "http://+:80;https://+:443" # Copy ARG EDITION=Community ARG VERSION=5.0.1 ARG RUNTIME=linux-x64 ARG SOURCE=/${EDITION}.${VERSION}.${RUNTIME} WORKDIR /app COPY ${SOURCE} ./ # Install wkhtmltopdf RUN apt update &&\ apt -y install wget &&\ wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb &&\ apt -y install ./wkhtmltox_0.12.6-1.buster_amd64.deb &&\ rm ./wkhtmltox_0.12.6-1.buster_amd64.deb ENTRYPOINT ["./Smartstore.Web", "--urls", "http://0.0.0.0:80"]
Wir wiederholen das ganze für die Datei dockerize.linux.nobuild.sh. Wir legen also eine neue Text-Datei an, kopieren den folgenden Inhalt hinein und speichern die Datei ab.
docker build -t smartstore-linux-image -f Dockerfile . echo 'Press enter to exit...'; read dummy;
With the -t
switch, the image is "tagged", i.e. given a name. These can be changed by smartstore-linux-image
as desired.
The result should look like this:
By running the file dockerize.linux.nobuild.sh
we can create the new image.