Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
devkelley committed Oct 9, 2023
1 parent 25939ee commit b59eee9
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ ARG APP_NAME
WORKDIR /app

COPY ./ .
COPY ./target/debug/*.yaml /app/target/debug/

# Add Build dependencies.
RUN apt update && apt upgrade -y
RUN apt install -y cmake protobuf-compiler pkg-config libssl-dev

# Build the application with the 'containerize' feature/
RUN cargo build --features containerize --release -p pub-sub-service
# Build the application with the 'containerize' feature.
RUN cargo build --features containerize --release -p $APP_NAME

RUN cp ./target/release/$APP_NAME /app/$APP_NAME
# Copy the built application to working directory.
RUN cp ./target/release/$APP_NAME /app/service

################################################################################
# Create a new stage for running the application that contains the minimal
Expand All @@ -41,8 +41,6 @@ RUN cp ./target/release/$APP_NAME /app/$APP_NAME
# reproducability is important, consider using a digest
# (e.g., debian@sha256:ac707220fbd7b67fc19b112cee8170b41a9e97f703f588b2cdbbcdcecdd8af57).
FROM debian:bullseye-slim AS final
ARG APP_NAME
ENV APP_NAME=$APP_NAME

# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user
Expand All @@ -60,11 +58,11 @@ USER appuser
WORKDIR /sdv

# Copy the executable from the "build" stage.
COPY --from=build /app/$APP_NAME /sdv/
COPY --from=build /app/service /sdv/
COPY --from=build /app/target/debug/*.yaml /sdv/target/debug/

# Expose the port that the application listens on.
EXPOSE 50051

# What the container should run when it is started.
CMD ./$APP_NAME
CMD ["/sdv/service"]

0 comments on commit b59eee9

Please sign in to comment.