Skip to content

Commit

Permalink
Adding Dockerfile.cbl-mariner-x64 file and updating dockerfiles (#192)
Browse files Browse the repository at this point in the history
* Updated Dockerfile with 8.0-jammy-chiseled for runtime, updated Dockerfile.nanoserver-x64 and Dockerfile.ubuntu by changing workdir for dotnet restore and build to match Dockerfile, added Dockerfile.cbl-mariner-x64 file

* Removed -r parameter for Run dotnet publish command

* added Dockerfile.chiseled file

* updated dockerfiles adding ARG ARCH with default values enabling user to build containers targeting different architecture

* Removed -r parameter from RUN dotnet publish command due to conflict with -a parameter

* --platform parameter is added to all linux flavor dockerfiles

* minor fix in Dockerfile

* Added argument TAG to Dockerfile.nanoserver for enabling to build different versions of Windows nanoserver
  • Loading branch information
irinasp authored Apr 1, 2024
1 parent b33189f commit b14a5e0
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ COPY --from=build /app .
EXPOSE 6379

# Run GarnetServer with an index size of 128MB
ENTRYPOINT ["/app/GarnetServer", "-i", "128m", "--port", "6379"]
ENTRYPOINT ["/app/GarnetServer", "-i", "128m", "--port", "6379"]
26 changes: 26 additions & 0 deletions Dockerfile.cbl-mariner
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-cbl-mariner2.0 AS build
ARG TARGETARCH

WORKDIR /source

# Copy files
COPY . .
WORKDIR /source/main/GarnetServer

RUN dotnet restore -a $TARGETARCH
RUN dotnet build -a $TARGETARCH -c Release

# Copy and publish app and libraries
RUN dotnet publish -a $TARGETARCH -c Release -o /app --self-contained false --no-restore -f net8.0

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

WORKDIR /app
COPY --from=build /app .

# For inter-container communication.
EXPOSE 6379

# Run GarnetServer with an index size of 128MB
ENTRYPOINT ["/app/GarnetServer", "-i", "128m", "--port", "6379"]
26 changes: 26 additions & 0 deletions Dockerfile.chiseled
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build
ARG TARGETARCH

WORKDIR /source

# Copy files
COPY . .
WORKDIR /source/main/GarnetServer

RUN dotnet restore -a $TARGETARCH
RUN dotnet build -a $TARGETARCH -c Release

# Copy and publish app and libraries
RUN dotnet publish -a $TARGETARCH -c Release -o /app --self-contained false --no-restore -f net8.0

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

WORKDIR /app
COPY --from=build /app .

# For inter-container communication.
EXPOSE 6379

# Run GarnetServer with an index size of 128MB
ENTRYPOINT ["/app/GarnetServer", "-i", "128m", "--port", "6379"]
11 changes: 7 additions & 4 deletions Dockerfile.nanoserver-x64 → Dockerfile.nanoserver
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-ltsc2022 AS build
ARG TAG=ltsc2022
FROM mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-$TAG AS build

WORKDIR /source

# Copy files
COPY . .
WORKDIR /source/main/GarnetServer

RUN dotnet restore
RUN dotnet build -c Release

# Copy and publish app and libraries
WORKDIR /source/main/GarnetServer
RUN dotnet publish -c Release -o /app -r win-x64 --self-contained false -f net8.0

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

# For inter-container communication.
EXPOSE 6379

# Run GarnetServer with an index size of 128MB
ENTRYPOINT ["/app/GarnetServer.exe", "-i", "128m", "--port", "6379"]
ENTRYPOINT ["/app/GarnetServer.exe", "-i", "128m", "--port", "6379"]
15 changes: 9 additions & 6 deletions Dockerfile.ubuntu-x64 → Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG TARGETARCH

WORKDIR /source

# Copy files
COPY . .
RUN dotnet restore
RUN dotnet build -c Release
WORKDIR /source/main/GarnetServer

RUN dotnet restore -a $TARGETARCH
RUN dotnet build -a $TARGETARCH -c Release

# Copy and publish app and libraries
WORKDIR /source/main/GarnetServer
RUN dotnet publish -c Release -o /app -r linux-x64 --self-contained false -f net8.0
RUN dotnet publish -a $TARGETARCH -c Release -o /app --self-contained false -f net8.0

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

Expand Down
6 changes: 4 additions & 2 deletions Garnet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
docker-compose.yml = docker-compose.yml
.github\workflows\docker.yml = .github\workflows\docker.yml
Dockerfile = Dockerfile
Dockerfile.nanoserver-x64 = Dockerfile.nanoserver-x64
Dockerfile.ubuntu-x64 = Dockerfile.ubuntu-x64
Dockerfile.cbl-mariner = Dockerfile.cbl-mariner
Garnet.nuspec = Garnet.nuspec
Dockerfile.chiseled = Dockerfile.chiseled
Dockerfile.nanoserver = Dockerfile.nanoserver
Dockerfile.ubuntu = Dockerfile.ubuntu
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bitmap", "playground\Bitmap\Bitmap.csproj", "{B9FA7D45-6DAE-4D56-AD7E-BB6C987A58C5}"
Expand Down

0 comments on commit b14a5e0

Please sign in to comment.