Skip to content

Commit

Permalink
test dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
area363 committed Jul 30, 2024
1 parent 725ad6a commit 51c5283
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 24 deletions.
24 changes: 16 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
# Use the official .NET SDK image to build the application
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
ARG COMMIT

COPY ./libplanet/src/Libplanet/Libplanet.csproj ./Libplanet/
COPY ./libplanet/src/Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj ./Libplanet.RocksDBStore/
COPY ./NineChronicles.Snapshot/NineChronicles.Snapshot.csproj ./NineChronicles.Snapshot/
# Copy the entire project directories
COPY ./libplanet/src/Libplanet ./Libplanet
COPY ./libplanet/src/Libplanet.RocksDBStore ./Libplanet.RocksDBStore
COPY ./NineChronicles.Snapshot ./NineChronicles.Snapshot

# Restore all projects at once
# Restore dependencies for each project
RUN dotnet restore ./Libplanet/Libplanet.csproj
RUN dotnet restore ./Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj
RUN dotnet restore ./NineChronicles.Snapshot/NineChronicles.Snapshot.csproj

# Copy everything else and build
# Copy the rest of the files and publish the application
COPY . ./
RUN dotnet publish NineChronicles.Snapshot/NineChronicles.Snapshot.csproj \
RUN dotnet publish ./NineChronicles.Snapshot/NineChronicles.Snapshot.csproj \
-c Release \
-r linux-x64 \
-o out \
--self-contained \
--version-suffix $COMMIT

# Build runtime image
# Build the runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
RUN apt-get update && apt-get install -y libc6-dev

# Install necessary dependencies
RUN apt-get update && apt-get install -y --no-install-recommends libc6-dev && apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy the published application from the build environment
COPY --from=build-env /app/out .

# Define the volume for persistent data storage
VOLUME /data

# Set the entry point to run the application
ENTRYPOINT ["dotnet", "NineChronicles.Snapshot.dll"]
24 changes: 16 additions & 8 deletions Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
# Use the official .NET SDK image to build the application
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
ARG COMMIT

COPY ./libplanet/src/Libplanet/Libplanet.csproj ./Libplanet/
COPY ./libplanet/src/Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj ./Libplanet.RocksDBStore/
COPY ./NineChronicles.Snapshot/NineChronicles.Snapshot.csproj ./NineChronicles.Snapshot/
# Copy the entire project directories
COPY ./libplanet/src/Libplanet ./Libplanet
COPY ./libplanet/src/Libplanet.RocksDBStore ./Libplanet.RocksDBStore
COPY ./NineChronicles.Snapshot ./NineChronicles.Snapshot

# Restore all projects at once
# Restore dependencies for each project
RUN dotnet restore ./Libplanet/Libplanet.csproj
RUN dotnet restore ./Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj
RUN dotnet restore ./NineChronicles.Snapshot/NineChronicles.Snapshot.csproj

# Copy everything else and build
# Copy the rest of the files and publish the application
COPY . ./
RUN dotnet publish NineChronicles.Snapshot/NineChronicles.Snapshot.csproj \
RUN dotnet publish ./NineChronicles.Snapshot/NineChronicles.Snapshot.csproj \
-c Release \
-r linux-x64 \
-o out \
--self-contained \
--version-suffix $COMMIT

# Build runtime image
# Build the runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
RUN apt-get update && apt-get install -y libc6-dev

# Install necessary dependencies
RUN apt-get update && apt-get install -y --no-install-recommends libc6-dev && apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy the published application from the build environment
COPY --from=build-env /app/out .

# Define the volume for persistent data storage
VOLUME /data

# Set the entry point to run the application
ENTRYPOINT ["dotnet", "NineChronicles.Snapshot.dll"]
24 changes: 16 additions & 8 deletions Dockerfile.arm64v8
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
# Use the official .NET SDK image to build the application
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
ARG COMMIT

COPY ./libplanet/src/Libplanet/Libplanet.csproj ./Libplanet/
COPY ./libplanet/src/Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj ./Libplanet.RocksDBStore/
COPY ./NineChronicles.Snapshot/NineChronicles.Snapshot.csproj ./NineChronicles.Snapshot/
# Copy the entire project directories
COPY ./libplanet/src/Libplanet ./Libplanet
COPY ./libplanet/src/Libplanet.RocksDBStore ./Libplanet.RocksDBStore
COPY ./NineChronicles.Snapshot ./NineChronicles.Snapshot

# Restore all projects at once
# Restore dependencies for each project
RUN dotnet restore ./Libplanet/Libplanet.csproj
RUN dotnet restore ./Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj
RUN dotnet restore ./NineChronicles.Snapshot/NineChronicles.Snapshot.csproj

# Copy everything else and build
# Copy the rest of the files and publish the application
COPY . ./
RUN dotnet publish NineChronicles.Snapshot/NineChronicles.Snapshot.csproj \
RUN dotnet publish ./NineChronicles.Snapshot/NineChronicles.Snapshot.csproj \
-c Release \
-r linux-arm64 \
-o out \
--self-contained \
--version-suffix $COMMIT

# Build runtime image
# Build the runtime image
FROM --platform=linux/arm64 mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim-arm64v8
WORKDIR /app
RUN apt-get update && apt-get install -y libc6-dev

# Install necessary dependencies
RUN apt-get update && apt-get install -y --no-install-recommends libc6-dev && apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy the published application from the build environment
COPY --from=build-env /app/out .

# Define the volume for persistent data storage
VOLUME /data

# Set the entry point to run the application
ENTRYPOINT ["dotnet", "NineChronicles.Snapshot.dll"]

0 comments on commit 51c5283

Please sign in to comment.