forked from microsoft/garnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve dockerfiles * Set docker image distro as ubuntu * Add Alpine based Dockfile * Remove line breaks * Add .dockerignore * Simply .dockerignore * Fix arch issue for nano server * Fix nanoserver docker build issue * Revert nanoserver dockerfile --------- Co-authored-by: Badrish Chandramouli <[email protected]> Co-authored-by: Irina Spiridonova <[email protected]>
- Loading branch information
1 parent
2ad50bc
commit a8570ac
Showing
7 changed files
with
159 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Directories | ||
**/bin | ||
**/obj | ||
.git | ||
.vs | ||
.vscode | ||
|
||
# Files | ||
.gitignore | ||
**/*.md | ||
docker-compose.yml | ||
docker-compose.*.yml | ||
Dockerfile* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,40 @@ | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build | ||
ARG TARGETARCH | ||
WORKDIR /source | ||
WORKDIR /src | ||
|
||
# Copy files | ||
COPY . . | ||
WORKDIR /source/main/GarnetServer | ||
# Copy csproj and restore as distinct layers | ||
COPY libs/client/*.csproj libs/client/ | ||
COPY libs/cluster/*.csproj libs/cluster/ | ||
COPY libs/common/*.csproj libs/common/ | ||
COPY libs/host/*.csproj libs/host/ | ||
COPY libs/server/*.csproj libs/server/ | ||
COPY libs/storage/Tsavorite/cs/src/core/*.csproj libs/storage/Tsavorite/cs/src/core/ | ||
COPY libs/storage/Tsavorite/cs/src/devices/AzureStorageDevice/*.csproj libs/storage/Tsavorite/cs/src/devices/AzureStorageDevice/ | ||
COPY main/GarnetServer/*.csproj main/GarnetServer/ | ||
COPY metrics/HdrHistogram/*.csproj metrics/HdrHistogram/ | ||
|
||
RUN dotnet restore -a $TARGETARCH | ||
RUN dotnet build -a $TARGETARCH -c Release | ||
RUN dotnet restore main/GarnetServer/GarnetServer.csproj -a $TARGETARCH | ||
|
||
# Copy and publish app and libraries | ||
RUN dotnet publish -a $TARGETARCH -c Release -o /app --self-contained false -f net8.0 | ||
# Copy everthing else and publish app | ||
COPY Garnet.snk Garnet.snk | ||
COPY libs/ libs/ | ||
COPY main/ main/ | ||
COPY metrics/ metrics/ | ||
COPY test/testcerts test/testcerts | ||
|
||
WORKDIR /src/main/GarnetServer | ||
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --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 . | ||
|
||
# Run container as a non-root user | ||
USER $APP_UID | ||
|
||
# For inter-container communication. | ||
EXPOSE 6379 | ||
|
||
# Run GarnetServer with an index size of 128MB | ||
ENTRYPOINT ["/app/GarnetServer", "-i", "128m", "--port", "6379"] | ||
ENTRYPOINT ["./GarnetServer", "-i", "128m", "--port", "6379"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build | ||
ARG TARGETARCH | ||
WORKDIR /src | ||
|
||
# Copy csproj and restore as distinct layers | ||
COPY libs/client/*.csproj libs/client/ | ||
COPY libs/cluster/*.csproj libs/cluster/ | ||
COPY libs/common/*.csproj libs/common/ | ||
COPY libs/host/*.csproj libs/host/ | ||
COPY libs/server/*.csproj libs/server/ | ||
COPY libs/storage/Tsavorite/cs/src/core/*.csproj libs/storage/Tsavorite/cs/src/core/ | ||
COPY libs/storage/Tsavorite/cs/src/devices/AzureStorageDevice/*.csproj libs/storage/Tsavorite/cs/src/devices/AzureStorageDevice/ | ||
COPY main/GarnetServer/*.csproj main/GarnetServer/ | ||
COPY metrics/HdrHistogram/*.csproj metrics/HdrHistogram/ | ||
|
||
RUN dotnet restore main/GarnetServer/GarnetServer.csproj -a $TARGETARCH | ||
|
||
# Copy everthing else and publish app | ||
COPY Garnet.snk Garnet.snk | ||
COPY libs/ libs/ | ||
COPY main/ main/ | ||
COPY metrics/ metrics/ | ||
COPY test/testcerts test/testcerts | ||
|
||
WORKDIR /src/main/GarnetServer | ||
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -f net8.0 | ||
|
||
# Final stage/image | ||
FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS runtime | ||
WORKDIR /app | ||
COPY --from=build /app . | ||
|
||
# Run container as a non-root user | ||
USER $APP_UID | ||
|
||
# For inter-container communication. | ||
EXPOSE 6379 | ||
|
||
# Run GarnetServer with an index size of 128MB | ||
ENTRYPOINT ["./GarnetServer", "-i", "128m", "--port", "6379"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,40 @@ | ||
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 | ||
WORKDIR /src | ||
|
||
# Copy csproj and restore as distinct layers | ||
COPY libs/client/*.csproj libs/client/ | ||
COPY libs/cluster/*.csproj libs/cluster/ | ||
COPY libs/common/*.csproj libs/common/ | ||
COPY libs/host/*.csproj libs/host/ | ||
COPY libs/server/*.csproj libs/server/ | ||
COPY libs/storage/Tsavorite/cs/src/core/*.csproj libs/storage/Tsavorite/cs/src/core/ | ||
COPY libs/storage/Tsavorite/cs/src/devices/AzureStorageDevice/*.csproj libs/storage/Tsavorite/cs/src/devices/AzureStorageDevice/ | ||
COPY main/GarnetServer/*.csproj main/GarnetServer/ | ||
COPY metrics/HdrHistogram/*.csproj metrics/HdrHistogram/ | ||
|
||
RUN dotnet restore main/GarnetServer/GarnetServer.csproj -a $TARGETARCH | ||
|
||
# Copy everthing else and publish app | ||
COPY Garnet.snk Garnet.snk | ||
COPY libs/ libs/ | ||
COPY main/ main/ | ||
COPY metrics/ metrics/ | ||
COPY test/testcerts test/testcerts | ||
|
||
WORKDIR /src/main/GarnetServer | ||
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -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 . | ||
|
||
# Run container as a non-root user | ||
USER $APP_UID | ||
|
||
# For inter-container communication. | ||
EXPOSE 6379 | ||
|
||
# Run GarnetServer with an index size of 128MB | ||
ENTRYPOINT ["/app/GarnetServer", "-i", "128m", "--port", "6379"] | ||
ENTRYPOINT ["./GarnetServer", "-i", "128m", "--port", "6379"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,37 @@ | ||
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 | ||
WORKDIR /src | ||
|
||
# Copy csproj and restore as distinct layers | ||
COPY libs/client/*.csproj libs/client/ | ||
COPY libs/cluster/*.csproj libs/cluster/ | ||
COPY libs/common/*.csproj libs/common/ | ||
COPY libs/host/*.csproj libs/host/ | ||
COPY libs/server/*.csproj libs/server/ | ||
COPY libs/storage/Tsavorite/cs/src/core/*.csproj libs/storage/Tsavorite/cs/src/core/ | ||
COPY libs/storage/Tsavorite/cs/src/devices/AzureStorageDevice/*.csproj libs/storage/Tsavorite/cs/src/devices/AzureStorageDevice/ | ||
COPY main/GarnetServer/*.csproj main/GarnetServer/ | ||
COPY metrics/HdrHistogram/*.csproj metrics/HdrHistogram/ | ||
|
||
RUN dotnet restore main/GarnetServer/GarnetServer.csproj -a $TARGETARCH | ||
|
||
# Copy everthing else and publish app | ||
COPY Garnet.snk Garnet.snk | ||
COPY libs/ libs/ | ||
COPY main/ main/ | ||
COPY metrics/ metrics/ | ||
COPY test/testcerts test/testcerts | ||
|
||
WORKDIR /src/main/GarnetServer | ||
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -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"] | ||
ENTRYPOINT ["./GarnetServer", "-i", "128m", "--port", "6379"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,40 @@ | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build | ||
ARG TARGETARCH | ||
WORKDIR /src | ||
|
||
WORKDIR /source | ||
# Copy csproj and restore as distinct layers | ||
COPY libs/client/*.csproj libs/client/ | ||
COPY libs/cluster/*.csproj libs/cluster/ | ||
COPY libs/common/*.csproj libs/common/ | ||
COPY libs/host/*.csproj libs/host/ | ||
COPY libs/server/*.csproj libs/server/ | ||
COPY libs/storage/Tsavorite/cs/src/core/*.csproj libs/storage/Tsavorite/cs/src/core/ | ||
COPY libs/storage/Tsavorite/cs/src/devices/AzureStorageDevice/*.csproj libs/storage/Tsavorite/cs/src/devices/AzureStorageDevice/ | ||
COPY main/GarnetServer/*.csproj main/GarnetServer/ | ||
COPY metrics/HdrHistogram/*.csproj metrics/HdrHistogram/ | ||
|
||
# Copy files | ||
COPY . . | ||
WORKDIR /source/main/GarnetServer | ||
RUN dotnet restore main/GarnetServer/GarnetServer.csproj -a $TARGETARCH | ||
|
||
RUN dotnet restore -a $TARGETARCH | ||
RUN dotnet build -a $TARGETARCH -c Release | ||
# Copy everthing else and publish app | ||
COPY Garnet.snk Garnet.snk | ||
COPY libs/ libs/ | ||
COPY main/ main/ | ||
COPY metrics/ metrics/ | ||
COPY test/testcerts test/testcerts | ||
|
||
# Copy and publish app and libraries | ||
RUN dotnet publish -a $TARGETARCH -c Release -o /app --self-contained false -f net8.0 | ||
WORKDIR /src/main/GarnetServer | ||
RUN dotnet publish -a $TARGETARCH -c Release -o /app --no-restore --self-contained false -f net8.0 | ||
|
||
# Final stage/image | ||
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime | ||
FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy AS runtime | ||
WORKDIR /app | ||
COPY --from=build /app . | ||
|
||
# Run container as a non-root user | ||
USER $APP_UID | ||
|
||
# For inter-container communication. | ||
EXPOSE 6379 | ||
|
||
# Run GarnetServer with an index size of 128MB | ||
ENTRYPOINT ["/app/GarnetServer", "-i", "128m", "--port", "6379"] | ||
ENTRYPOINT ["./GarnetServer", "-i", "128m", "--port", "6379"] |