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
8 changes: 4 additions & 4 deletions .github/workflows/docker-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
image: ghcr.io/${{ github.repository }}-alpine
os: ubuntu-latest
- dockerfile: Dockerfile.ubuntu
image: ghcr.io/${{ github.repository }}-jammy
image: ghcr.io/${{ github.repository }}-noble
os: ubuntu-latest
- dockerfile: Dockerfile.chiseled
image: ghcr.io/${{ github.repository }}-jammy-chiseled
image: ghcr.io/${{ github.repository }}-noble-chiseled
os: ubuntu-latest
- dockerfile: Dockerfile.cbl-mariner
image: ghcr.io/${{ github.repository }}-cbl-mariner2.0
- dockerfile: Dockerfile.azurelinux
image: ghcr.io/${{ github.repository }}-azurelinux3.0
os: ubuntu-latest
runs-on: ${{ matrix.os }}
permissions:
Expand Down
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,23 @@ COPY test/testcerts test/testcerts
RUN sed -i 's/"ProtectedMode": "yes",/"ProtectedMode": "no",/' /src/libs/host/defaults.conf

WORKDIR /src/main/GarnetServer
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -f net8.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -f net10.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false

# Delete xmldoc files
RUN find /app -name '*.xml' -delete

# Final stage/image
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime
FROM mcr.microsoft.com/dotnet/runtime:10.0 AS runtime

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libaio1 \
libaio1t64 \
liblua5.4-0 \
dpkg-dev \
&& ARCH="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" \
&& ARCH="$(uname -m)" \
&& case "$ARCH" in x86_64) MULTIARCH="x86_64-linux-gnu";; aarch64) MULTIARCH="aarch64-linux-gnu";; *) MULTIARCH="$ARCH-linux-gnu";; esac \
&& ln -sf "/usr/lib/${MULTIARCH}/libaio.so.1t64" "/usr/lib/${MULTIARCH}/libaio.so.1" \
&& DN_DIR=$(ls -d /usr/share/dotnet/shared/Microsoft.NETCore.App/* 2>/dev/null | head -n1 || true) \
&& if [ -n "$DN_DIR" ]; then ln -sf "/usr/lib/${ARCH}/liblua5.4.so.0" "$DN_DIR/liblua54.so"; fi \
&& if [ -n "$DN_DIR" ]; then ln -sf "/usr/lib/${MULTIARCH}/liblua5.4.so.0" "$DN_DIR/liblua54.so"; fi \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir /data /app \
Expand Down
10 changes: 6 additions & 4 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,22 @@ COPY test/testcerts test/testcerts
RUN sed -i 's/"ProtectedMode": "yes",/"ProtectedMode": "no",/' /src/libs/host/defaults.conf

WORKDIR /src/main/GarnetServer
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -f net8.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -f net10.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false

# Delete xmldoc files
RUN find /app -name '*.xml' -delete

# Remove glibc-compiled Lua bundled by KeraLua NuGet; Alpine uses musl-compiled system Lua instead
RUN rm -f /app/liblua54.so

# Final stage/image
FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS runtime
FROM mcr.microsoft.com/dotnet/runtime:10.0-alpine AS runtime

# Install dependencies
RUN apk update && apk add --no-cache \
RUN apk add --no-cache \
libaio \
gcompat \
lua5.4-libs \
&& ARCH="$(apk --print-arch)" \
&& DN_DIR=$(ls -d /usr/share/dotnet/shared/Microsoft.NETCore.App/* 2>/dev/null | head -n1 || true) \
&& if [ -n "$DN_DIR" ]; then ln -sf "/usr/lib/liblua-5.4.so.0" "$DN_DIR/liblua54.so"; fi

Expand Down
24 changes: 6 additions & 18 deletions Dockerfile.cbl-mariner → Dockerfile.azurelinux
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,18 @@ COPY test/testcerts test/testcerts
RUN sed -i 's/"ProtectedMode": "yes",/"ProtectedMode": "no",/' /src/libs/host/defaults.conf

WORKDIR /src/main/GarnetServer
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -f net8.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -f net10.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false

# Delete xmldoc files
RUN find /app -name '*.xml' -delete

# --- Lua builder stage ---
FROM ubuntu:22.04 AS lua-builder
RUN apt-get update \
&& apt-get install -y --no-install-recommends liblua5.4-0 dpkg-dev \
&& ARCH="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" \
&& mkdir -p /lua \
&& cp "/usr/lib/${ARCH}/liblua5.4.so.0" /lua/ \
&& ln -sf "liblua5.4.so.0" /lua/liblua54.so \
&& rm -rf /var/lib/apt/lists/*

# Final stage/image
FROM mcr.microsoft.com/dotnet/runtime:8.0-cbl-mariner2.0 AS runtime

COPY --from=lua-builder /lua /lua
RUN DN_DIR=$(ls -d /usr/share/dotnet/shared/Microsoft.NETCore.App/* | head -n1) \
&& cp /lua/liblua54.so "$DN_DIR/liblua54.so"
FROM mcr.microsoft.com/dotnet/runtime:10.0-azurelinux3.0 AS runtime

# Install libaio
RUN tdnf install -y libaio && tdnf clean all
# Install libaio; lua-libs is already present in the base image
RUN tdnf install -y libaio && tdnf clean all \
&& DN_DIR=$(ls -d /usr/share/dotnet/shared/Microsoft.NETCore.App/* | head -n1) \
&& ln -sf "/usr/lib/liblua-5.4.so" "$DN_DIR/liblua54.so"

RUN mkdir /data /app \
&& chown -R $APP_UID:$APP_UID /data /app
Expand Down
28 changes: 17 additions & 11 deletions Dockerfile.chiseled
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,42 @@ COPY test/testcerts test/testcerts
RUN sed -i 's/"ProtectedMode": "yes",/"ProtectedMode": "no",/' /src/libs/host/defaults.conf

WORKDIR /src/main/GarnetServer
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -f net8.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -f net10.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false

# Delete xmldoc files
RUN find /app -name '*.xml' -delete

# --- Lua builder stage ---
FROM ubuntu:22.04 AS lua-builder
# --- Lua and libaio builder stage ---
FROM ubuntu:24.04 AS libs-builder
RUN apt-get update \
&& apt-get install -y --no-install-recommends liblua5.4-0 dpkg-dev \
&& ARCH="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" \
&& mkdir -p /lua \
&& cp "/usr/lib/${ARCH}/liblua5.4.so.0" /lua/ \
&& ln -sf "liblua5.4.so.0" /lua/liblua54.so \
&& apt-get install -y --no-install-recommends liblua5.4-0 libaio1t64 \
&& ARCH="$(uname -m)" \
&& case "$ARCH" in x86_64) MULTIARCH="x86_64-linux-gnu";; aarch64) MULTIARCH="aarch64-linux-gnu";; *) MULTIARCH="$ARCH-linux-gnu";; esac \
&& mkdir -p /staging/lua /staging/libaio \
&& cp "/usr/lib/${MULTIARCH}/liblua5.4.so.0" /staging/lua/ \
&& ln -sf "liblua5.4.so.0" /staging/lua/liblua54.so \
&& cp "/usr/lib/${MULTIARCH}/libaio.so.1t64" /staging/libaio/ \
&& ln -sf "libaio.so.1t64" /staging/libaio/libaio.so.1 \
&& rm -rf /var/lib/apt/lists/*

# --- .NET build and layout prep ---
FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy AS prep-runtime
FROM mcr.microsoft.com/dotnet/runtime:10.0-noble AS prep-runtime

# prep-runtime image HAS /bin/sh, so we can script here
COPY --from=lua-builder /lua /lua
COPY --from=libs-builder /staging/lua /lua
RUN DN_DIR=$(ls -d /usr/share/dotnet/shared/Microsoft.NETCore.App/* | head -n1) \
&& cp /lua/liblua54.so "$DN_DIR/liblua54.so"

# Final stage/image
FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy-chiseled AS runtime
FROM mcr.microsoft.com/dotnet/runtime:10.0-noble-chiseled AS runtime
WORKDIR /app

COPY --from=build --chown=$APP_UID:$APP_UID /data /data
# Copy the pre-symlinked .NET shared directory from prep-runtime
COPY --from=prep-runtime /usr/share/dotnet/shared /usr/share/dotnet/shared
# Copy libaio for native device support (copy the real file, then symlink in the chiseled image via prep-runtime)
COPY --from=libs-builder /staging/libaio/libaio.so.1t64 /usr/lib/libaio.so.1t64
COPY --from=libs-builder /staging/libaio/libaio.so.1 /usr/lib/libaio.so.1
COPY --from=build /app .

VOLUME /data
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.nanoserver
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ WORKDIR /src/main/GarnetServer
# Restore, build, and publish
RUN dotnet restore && \
dotnet build -c Release -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false && \
dotnet publish -c Release -o /app -r win-x64 --self-contained false -f net8.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false
dotnet publish -c Release -o /app -r win-x64 --self-contained false -f net10.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false

# Delete xmldoc files
RUN pwsh -Command "gci -Path /app -Filter '*.xml' -Recurse | del -Force"

# Final stage/image
FROM mcr.microsoft.com/dotnet/runtime:8.0-nanoserver-$TAG AS runtime
FROM mcr.microsoft.com/dotnet/runtime:10.0-nanoserver-$TAG AS runtime
WORKDIR /app
COPY --from=build /app .

Expand Down
20 changes: 8 additions & 12 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,24 @@ COPY test/testcerts test/testcerts
RUN sed -i 's/"ProtectedMode": "yes",/"ProtectedMode": "no",/' /src/libs/host/defaults.conf

WORKDIR /src/main/GarnetServer
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -f net8.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -f net10.0 -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false

# Delete xmldoc files
RUN find /app -name '*.xml' -delete

# Separate stage to install libaio1 on amd64 (avoiding QEMU issues on arm64)
FROM --platform=linux/amd64 mcr.microsoft.com/mirror/docker/library/ubuntu:22.04 AS builder
RUN apt-get update && apt-get install -y libaio1

# Final stage/image
FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy AS runtime

# Copy libaio1 from amd64 builder stage (avoiding installation under QEMU)
COPY --from=builder /usr/lib/x86_64-linux-gnu/libaio.so.1 /usr/lib/x86_64-linux-gnu/
FROM mcr.microsoft.com/dotnet/runtime:10.0-noble AS runtime

# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libaio1t64 \
liblua5.4-0 \
dpkg-dev \
&& ARCH="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" \
&& ARCH="$(uname -m)" \
&& case "$ARCH" in x86_64) MULTIARCH="x86_64-linux-gnu";; aarch64) MULTIARCH="aarch64-linux-gnu";; *) MULTIARCH="$ARCH-linux-gnu";; esac \
&& ln -sf "/usr/lib/${MULTIARCH}/libaio.so.1t64" "/usr/lib/${MULTIARCH}/libaio.so.1" \
&& DN_DIR=$(ls -d /usr/share/dotnet/shared/Microsoft.NETCore.App/* 2>/dev/null | head -n1 || true) \
&& if [ -n "$DN_DIR" ]; then ln -sf "/usr/lib/${ARCH}/liblua5.4.so.0" "$DN_DIR/liblua54.so"; fi \
&& if [ -n "$DN_DIR" ]; then ln -sf "/usr/lib/${MULTIARCH}/liblua5.4.so.0" "$DN_DIR/liblua54.so"; fi \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir /data /app \
Expand Down
Loading
Loading