Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions .github/workflows/github-actions-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4

- name: Build image
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand All @@ -40,18 +40,40 @@ jobs:
- name: Print versions of the tools
run: |
docker run --rm "${{ env.IMAGE_NAME }}:${{ env.DOTNET_SDK_VERSION }}-ci" /bin/bash -lc '
source ~/.bashrc
echo "******* Environment variables ******"
echo "DOTNET_SDK_VERSION=${DOTNET_SDK_VERSION}";
echo "NODE_VERSION=${NODE_VERSION}";
echo "NPM_VERSION=${NPM_VERSION}";
echo "SEVENZIP_VERSION=${SEVENZIP_VERSION}";
echo "SQLCMD_VERSION=${SQLCMD_VERSION}";
echo "TAR_VERSION=${TAR_VERSION}";
echo "WIM_VERSION=${WIM_VERSION}";
echo "ZIP_VERSION=${ZIP_VERSION}";
echo "";
echo "PATH=$PATH";
echo "";
echo "******* .NET ******"
dotnet --info
echo "";
echo "******* Node.JS ******"
node -v
echo "";
echo "******* NPM ******"
npm -v
echo "";
echo "******* sqlcmd ******"
sqlcmd --version 2>&1
echo "";
echo "******* 7-Zip ******"
7z i
echo "";
echo "******* Tar ******"
tar --version
echo "";
echo "******* WIM ******"
wimlib-imagex --version
echo "";
echo "******* Zip ******"
zip --version
'
17 changes: 13 additions & 4 deletions .github/workflows/github-actions-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push (version)
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
Expand All @@ -51,9 +51,14 @@ jobs:
id: tools_versions
run: |
docker run --rm "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DOTNET_SDK_VERSION }}" /bin/bash -lc '
source ~/.bashrc
echo "NODE_VERSION=${NODE_VERSION}"
echo "NPM_VERSION=${NPM_VERSION}"
echo "SEVENZIP_VERSION=${SEVENZIP_VERSION}"
echo "SQLCMD_VERSION=${SQLCMD_VERSION}"
echo "TAR_VERSION=${TAR_VERSION}"
echo "WIM_VERSION=${WIM_VERSION}"
echo "ZIP_VERSION=${ZIP_VERSION}"
' >> $GITHUB_OUTPUT

- name: Create Release
Expand All @@ -63,9 +68,13 @@ jobs:
name: "v${{ env.DOTNET_SDK_VERSION }}"
body: |
Initial version of the image with the following tools:
- 7-Zip: v${{ steps.tools_versions.outputs.SEVENZIP_VERSION }}
- Node.js: v${{ steps.tools_versions.outputs.NODE_VERSION }}
- npm: v${{ steps.tools_versions.outputs.NPM_VERSION }}
- sqlcmd: ${{ steps.tools_versions.outputs.SQLCMD_VERSION }}
- tar: v${{ steps.tools_versions.outputs.TAR_VERSION }}
- wimlib-imagex: ${{ steps.tools_versions.outputs.WIM_VERSION }}
- zip: v${{ steps.tools_versions.outputs.ZIP_VERSION }}

Based on [mcr.microsoft.com/dotnet/sdk:${{ env.DOTNET_SDK_VERSION }}](https://mcr.microsoft.com/en-us/product/dotnet/sdk/about)
draft: true
Expand Down
30 changes: 24 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ LABEL "com.azure.dev.pipelines.agent.handler.node.path"="/usr/bin/node"
# Install :
# - sqlcmd
# - NodeJS
# - Archive tools (zip, 7z, tar, wim)
RUN apt-get update && \
apt-get install -y curl apt-transport-https gnupg && \
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
Expand All @@ -27,7 +28,7 @@ RUN apt-get update && \
echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_24.x nodistro main" \
> /etc/apt/sources.list.d/nodesource.list; \
apt-get update && \
ACCEPT_EULA=Y apt-get install -y sqlcmd nodejs && \
ACCEPT_EULA=Y apt-get install -y sqlcmd nodejs zip p7zip-full tar wimtools && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

Expand All @@ -38,8 +39,25 @@ ENV PATH="${PATH}:~/.dotnet/tools:/opt/mssql-tools18/bin"

# Set the environment variable with the versions of the installed tools
RUN NODE_VERSION=$(node -v | sed 's/^v//') && \
echo "export NODE_VERSION=${NODE_VERSION}" >> ~/.bashrc && \
NPM_VERSION=$(npm -v) && \
echo "export NPM_VERSION=${NPM_VERSION}" >> ~/.bashrc && \
SQLCMD_VERSION=$(sqlcmd --version | head -n 1) && \
echo "export SQLCMD_VERSION=${SQLCMD_VERSION}" >> ~/.bashrc
NPM_VERSION=$(npm -v) && \
SEVENZIP_VERSION=$(7z i | awk '/^7-Zip/{print $2; exit}') && \
SQLCMD_VERSION=$(sqlcmd --version | head -n 1) && \
TAR_VERSION=$(tar --version | awk '/^tar/{print $4; exit}') && \
WIM_VERSION=$(wimlib-imagex --version | awk -F' \(using ' 'NR==1{print $1}') && \
ZIP_VERSION=$(zip -v | awk '/^This is Zip/{print $4; exit}') && \
cat > /etc/profile.d/tool-versions.sh <<EOF
export NODE_VERSION="${NODE_VERSION}"
export NPM_VERSION="${NPM_VERSION}"
export SEVENZIP_VERSION="${SEVENZIP_VERSION}"
export SQLCMD_VERSION="${SQLCMD_VERSION}"
export TAR_VERSION="${TAR_VERSION}"
export WIM_VERSION="${WIM_VERSION}"
export ZIP_VERSION="${ZIP_VERSION}"
EOF

# Entrypoint: always inject tool version environment variables in the current shell.
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh

ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["/bin/bash"]
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# dotnet-sdk-extended
Extended .NET SDK Docker image with sqlcmd, Node.js, and additional utilities
Extended .NET SDK Docker image with sqlcmd, Node.js, archive tools, and additional utilities

## Overview
dotnet-sdk-extended is a Docker image based on Microsoft's [mcr.microsoft.com/dotnet/sdk](https://mcr.microsoft.com/en-us/product/dotnet/sdk/about). It adds commonly needed build-time tools so your .NET builds run faster and more reliably in CI.

Included tools:
- Node.js (with npm)
- sqlcmd (cross-platform)
- zip
- 7z
- tar
- wim (via wimtools)

Image registry:
- ghcr.io/posinformatique/dotnet-sdk-extended
Expand All @@ -33,7 +37,11 @@ Image registry:
The image exposes the installed versions via:
- `NPM_VERSION`
- `NODE_VERSION`
- `SEVENZIP_VERSION`
- `SQLCMD_VERSION`
- `TAR_VERSION`
- `WIM_VERSION`
- `ZIP_VERSION`

These can be inspected in your CI steps if needed.

Expand Down
10 changes: 10 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e

# Load computed tool versions if present
if [ -f /etc/profile.d/tool-versions.sh ]; then
# shellcheck disable=SC1091
. /etc/profile.d/tool-versions.sh
fi

exec "$@"
Loading