-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into me/uniformCsharpNamespaces
- Loading branch information
Showing
5 changed files
with
94 additions
and
97 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
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
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,87 +1,88 @@ | ||
# Start with the latest Alpine base image for the build stage | ||
FROM alpine AS builder | ||
ARG GRPC_VERSION=v1.54.0 | ||
|
||
# Install all the necessary dependencies required for the build process | ||
# These include tools and libraries for building and compiling the source code | ||
RUN apk update && apk add --no-cache \ | ||
git \ | ||
gcc \ | ||
g++ \ | ||
build-base \ | ||
autoconf \ | ||
automake \ | ||
libtool \ | ||
curl \ | ||
c-ares \ | ||
c-ares-dev \ | ||
make \ | ||
cmake \ | ||
unzip \ | ||
linux-headers \ | ||
grpc \ | ||
grpc-dev \ | ||
protobuf \ | ||
protobuf-dev | ||
|
||
# Update the PATH environment variable to include the gRPC libraries and binaries | ||
ENV LD_LIBRARY_PATH="/app/install/lib:$LD_LIBRARY_PATH" | ||
ENV PATH="/app/install/bin:$PATH" | ||
|
||
# Display the updated PATH environment variable | ||
RUN echo $PATH | ||
|
||
# Copy the application source files into the image | ||
WORKDIR /app/source | ||
COPY ./packages/cpp/ArmoniK.Api.Common ./ArmoniK.Api.Common | ||
COPY ./packages/cpp/ArmoniK.Api.Worker ./ArmoniK.Api.Worker | ||
COPY ./packages/cpp/ArmoniK.Api.Worker.Tests ./ArmoniK.Api.Worker.Tests | ||
COPY ./packages/cpp/CMakeLists.txt ./ | ||
|
||
# Copy the Protocol Buffer definition files into the image | ||
WORKDIR /app/proto | ||
COPY ./Protos/V1/ /app/proto | ||
|
||
# Build the application using the copied source files and protobuf definitions | ||
WORKDIR /app/builder | ||
RUN cmake -DCMAKE_INSTALL_PREFIX="/app/install" -DPROTO_FILES_DIR="/app/proto" -DBUILD_TEST=ON -DBUILD_CLIENT=OFF -DBUILD_WORKER=ON /app/source/ | ||
RUN make -j $(nproc) install | ||
|
||
# Start with the latest Alpine base image for the final stage | ||
FROM alpine | ||
# Install all the necessary dependencies required for the build process | ||
# These include tools and libraries for building and compiling the source code | ||
RUN apk update && apk add --no-cache \ | ||
git \ | ||
gcc \ | ||
g++ \ | ||
build-base \ | ||
autoconf \ | ||
automake \ | ||
libtool \ | ||
curl \ | ||
c-ares \ | ||
c-ares-dev \ | ||
make \ | ||
cmake \ | ||
unzip \ | ||
linux-headers \ | ||
libprotobuf \ | ||
grpc \ | ||
grpc-cpp | ||
|
||
# Create a non-root user and group for running the application | ||
# This is a security best practice to avoid running applications as the root user | ||
RUN addgroup -g 5000 -S armonikuser && adduser -D -h /home/armonikuser -u 5000 -G armonikuser --shell /bin/sh armonikuser && mkdir /cache && chown armonikuser: /cache | ||
USER armonikuser | ||
|
||
# Copy the application files, libraries, and binaries from the builder image to the final image | ||
COPY --from=builder /app /app | ||
|
||
# Update the PATH environment variable to include the application libraries and binaries | ||
ENV LD_LIBRARY_PATH="/app/install/lib:$LD_LIBRARY_PATH" | ||
ENV PATH="/app/install/bin:$PATH" | ||
|
||
# Set the entrypoint for the application's test executable | ||
# This is the command that will be executed when the container is run | ||
ENTRYPOINT ["/app/install/bin/ArmoniK.Api.Worker.Tests"] | ||
# Start with the latest Alpine base image for the build stage | ||
FROM alpine AS builder | ||
ARG GRPC_VERSION=v1.54.0 | ||
|
||
# Install all the necessary dependencies required for the build process | ||
# These include tools and libraries for building and compiling the source code | ||
RUN apk update && apk add --no-cache \ | ||
git \ | ||
gcc \ | ||
g++ \ | ||
build-base \ | ||
autoconf \ | ||
automake \ | ||
libtool \ | ||
curl \ | ||
c-ares \ | ||
c-ares-dev \ | ||
make \ | ||
cmake \ | ||
unzip \ | ||
linux-headers \ | ||
grpc \ | ||
grpc-dev \ | ||
protobuf \ | ||
protobuf-dev \ | ||
libfmt-dev | ||
|
||
# Update the PATH environment variable to include the gRPC libraries and binaries | ||
ENV LD_LIBRARY_PATH="/app/install/lib:$LD_LIBRARY_PATH" | ||
ENV PATH="/app/install/bin:$PATH" | ||
|
||
# Display the updated PATH environment variable | ||
RUN echo $PATH | ||
|
||
# Copy the application source files into the image | ||
WORKDIR /app/source | ||
COPY ./packages/cpp/ArmoniK.Api.Common ./ArmoniK.Api.Common | ||
COPY ./packages/cpp/ArmoniK.Api.Worker ./ArmoniK.Api.Worker | ||
COPY ./packages/cpp/ArmoniK.Api.Worker.Tests ./ArmoniK.Api.Worker.Tests | ||
COPY ./packages/cpp/CMakeLists.txt ./ | ||
|
||
# Copy the Protocol Buffer definition files into the image | ||
WORKDIR /app/proto | ||
COPY ./Protos/V1/ /app/proto | ||
|
||
# Build the application using the copied source files and protobuf definitions | ||
WORKDIR /app/builder | ||
RUN cmake -DCMAKE_INSTALL_PREFIX="/app/install" -DPROTO_FILES_DIR="/app/proto" -DBUILD_TEST=ON -DBUILD_CLIENT=OFF -DBUILD_WORKER=ON /app/source/ | ||
RUN make -j $(nproc) install | ||
|
||
# Start with the latest Alpine base image for the final stage | ||
FROM alpine | ||
# Install all the necessary dependencies required for the build process | ||
# These include tools and libraries for building and compiling the source code | ||
RUN apk update && apk add --no-cache \ | ||
git \ | ||
gcc \ | ||
g++ \ | ||
build-base \ | ||
autoconf \ | ||
automake \ | ||
libtool \ | ||
curl \ | ||
c-ares \ | ||
c-ares-dev \ | ||
make \ | ||
cmake \ | ||
unzip \ | ||
linux-headers \ | ||
libprotobuf \ | ||
grpc \ | ||
grpc-cpp | ||
|
||
# Create a non-root user and group for running the application | ||
# This is a security best practice to avoid running applications as the root user | ||
RUN addgroup -g 5000 -S armonikuser && adduser -D -h /home/armonikuser -u 5000 -G armonikuser --shell /bin/sh armonikuser && mkdir /cache && chown armonikuser: /cache | ||
USER armonikuser | ||
|
||
# Copy the application files, libraries, and binaries from the builder image to the final image | ||
COPY --from=builder /app /app | ||
|
||
# Update the PATH environment variable to include the application libraries and binaries | ||
ENV LD_LIBRARY_PATH="/app/install/lib:$LD_LIBRARY_PATH" | ||
ENV PATH="/app/install/bin:$PATH" | ||
|
||
# Set the entrypoint for the application's test executable | ||
# This is the command that will be executed when the container is run | ||
ENTRYPOINT ["/app/install/bin/ArmoniK.Api.Worker.Tests"] |