-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Image on Windows Base Image #439 #2332
base: main
Are you sure you want to change the base?
Changes from all commits
3e8584d
c79f97f
f1488ab
51de33f
729f43e
0ac3aff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# | ||
# Base-Node | ||
# | ||
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022-amd64 AS nodewindows | ||
# Install dependencies first | ||
RUN mkdir c:\node | ||
WORKDIR c:\\node | ||
|
||
RUN curl.exe -o Node.zip https://nodejs.org/dist/v14.21.3/node-v14.21.3-win-x64.zip | ||
RUN tar -xf Node.zip -C c:\node | ||
RUN del Node.zip | ||
|
||
ENV PATH="$PATH;C:\Node\node-v14.21.3-win-x64" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we use node with a higher version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could, but then this Dockerfile would deviate from the linux containers version (which also is using Node 14). Also the build process would be slightly different (options like To me it feels like upgrading the node version should be a seperate issue, since the current Dockerfile also uses Node 14 and there will be changes needed in the build commands. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the new added docker image, hope it's adding with a good shape. So the node version should be in the recommended version list (better with LTS version): https://nodered.org/docs/faq/node-versions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've just tried updating to a newer version of Node (16/18/20) and it seems like I'm hitting npm/cli#4027. The current There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the update! Yes, for the new added docker image, we would like it be in the good shape. |
||
|
||
# | ||
# Builder | ||
# | ||
FROM nodewindows AS builder | ||
|
||
RUN mkdir c:\azurite | ||
WORKDIR c:\\azurite | ||
|
||
COPY *.json LICENSE NOTICE.txt ./ | ||
|
||
# Copy the source code and build the app | ||
COPY src ./src | ||
COPY tests ./tests | ||
RUN npm config set unsafe-perm=true && \ | ||
npm ci | ||
RUN npm run build && \ | ||
npm install -g --loglevel verbose | ||
|
||
|
||
# | ||
# Production image | ||
# | ||
FROM nodewindows | ||
|
||
ENV NODE_ENV=productions | ||
|
||
RUN mkdir c:\azurite | ||
WORKDIR c:\\azurite | ||
|
||
# Default Workspace Volume | ||
VOLUME [ "c:/data" ] | ||
|
||
COPY package*.json LICENSE NOTICE.txt ./ | ||
|
||
COPY --from=builder c:/azurite/dist/ dist/ | ||
|
||
RUN dir c:\azurite | ||
|
||
RUN npm config set unsafe-perm=true && \ | ||
npm install -g --loglevel verbose | ||
|
||
# Blob Storage Port | ||
EXPOSE 10000 | ||
# Queue Storage Port | ||
EXPOSE 10001 | ||
# Table Storage Port | ||
EXPOSE 10002 | ||
|
||
CMD "azurite -l c:/data --blobHost 0.0.0.0 --queueHost 0.0.0.0 --tableHost 0.0.0.0" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,16 +272,20 @@ | |
"vscode:pack": "vsce package", | ||
"docker:prebuild": "echo skip", | ||
"docker:build": "npm run docker:prebuild && cross-var docker build --no-cache --rm -f \"Dockerfile\" -t xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version . && cross-var docker tag xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version xstoreazurite.azurecr.io/public/azure-storage/azurite:latest", | ||
"docker:build-windows": "npm run docker:prebuild && cross-var docker build --no-cache --rm -f \"Dockerfile.Windows\" -t xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version . && cross-var docker tag xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version xstoreazurite.azurecr.io/public/azure-storage/azurite:latest", | ||
"docker:build:internal": "npm run docker:prebuild && cross-var docker build --no-cache --rm -f \"Dockerfile\" -t xstoreazurite.azurecr.io/internal/azure-storage/azurite:$npm_package_version . && cross-var docker tag xstoreazurite.azurecr.io/internal/azure-storage/azurite:$npm_package_version xstoreazurite.azurecr.io/internal/azure-storage/azurite:latest", | ||
"docker:build-windows:internal": "npm run docker:prebuild && cross-var docker build --no-cache --rm -f \"Dockerfile.Windows\" -t xstoreazurite.azurecr.io/internal/azure-storage/azurite:$npm_package_version . && cross-var docker tag xstoreazurite.azurecr.io/internal/azure-storage/azurite:$npm_package_version xstoreazurite.azurecr.io/internal/azure-storage/azurite:latest", | ||
"docker:publish": "cross-var docker push xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version", | ||
"docker:publish:internal": "cross-var docker push xstoreazurite.azurecr.io/internal/azure-storage/azurite:$npm_package_version", | ||
"docker:init-multi-platform-builder": "docker buildx create --name multi-platform-builder --use", | ||
"docker:build-amd64": "cross-var docker buildx build --platform linux/amd64 --load --no-cache --rm -f \"Dockerfile\" -t xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-amd64 .", | ||
"docker:build-windows-amd64": "cross-var docker buildx build --platform windows/amd64 --load --no-cache --rm -f \"Dockerfile.Windows\" -t xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-windows-amd64 .", | ||
"docker:build-arm64": "cross-var docker buildx build --platform linux/arm64 --load --no-cache --rm -f \"Dockerfile\" -t xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-arm64 .", | ||
"docker:publish-amd64": "cross-var docker push xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-amd64", | ||
"docker:publish-windows-amd64": "cross-var docker push xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-windows-amd64", | ||
"docker:publish-arm64": "cross-var docker push xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-arm64", | ||
"docker:create-manifest-versioned": "cross-var docker manifest create xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-amd64 xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-arm64", | ||
"docker:create-manifest-latest": "cross-var docker manifest create xstoreazurite.azurecr.io/public/azure-storage/azurite:latest xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-amd64 xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-arm64", | ||
"docker:create-manifest-versioned": "cross-var docker manifest create xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-amd64 xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-windows-amd64 xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-arm64", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to check what's the effect after publish the manifest. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The platform is chooses includes the os name, hence it currently throwing an error on windows ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With current Azurite release (before the change), I will install AMD64 docker image in my machine (my machine is windows with AMD64). And for the error, do you mean you will resolve it, or it's already resolved? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you are running Docker in Windows Container mode (this is an option within Docker-Desktop), with the current release this will throw an error. You can view the platform docker is running internally on with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Get it. Thanks! And on my windows machine run |
||
"docker:create-manifest-latest": "cross-var docker manifest create xstoreazurite.azurecr.io/public/azure-storage/azurite:latest xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-amd64 xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-windows-amd64 xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version-arm64", | ||
"docker:publish-manifest-versioned": "cross-var docker manifest push xstoreazurite.azurecr.io/public/azure-storage/azurite:$npm_package_version", | ||
"docker:publish-manifest-latest": "cross-var docker manifest push xstoreazurite.azurecr.io/public/azure-storage/azurite:latest", | ||
"prepare": "npm run build", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to build docker image on my win10 machine failed:
My machine has:
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.404\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What type of containers are you running? The error seems to be related with running Linux Containers instead of Windows Containers. (You can check with
docker info -f "{{.OSType}}"
and switch using the context menu of docker desktopSwitch to Windows containers
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have switched docker on my machine to Windows.
However, run
npm run docker:build-windows
will still fail.See failure log:
2024-01-08T09_30_37_462Z-debug.log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see the actual exception in the logfile. From what I see one of the child processes spawned by the npm command died with an error, do you have a log of the subcommand that failed?
Running the command with the same node & npm versions as specified in the logfile does not trigger any error at my side (nor on DevOps).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After I upgrade node to LTS version, and try again, I meet following error:
It looks my windows version is lower than the image and cause the docker image build failure.
I will try to upgrade my machine or find a new machine and try build it. However, it might need some time.
Will update you later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can successfully build the docker image on a win11 machine with node 18.19.0.
However, get following warning.
So to get the new docker image in good shape, we should increasing node version.