Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile Optimization #37

Merged
merged 25 commits into from
Feb 1, 2024
Merged

Conversation

dmccoystephenson
Copy link
Contributor

Changes

Some changes have been made to the Dockerfiles with the aim to enhance performance and efficiency:

  1. Base Image: The base image in the Dockerfiles has been switched from Ubuntu to Alpine, resulting in smaller and faster deployments.
  2. Splitting Dockerfiles: The Dockerfiles are now divided into two images - the builder image and the runtime image. The project is built within the builder container, and only the necessary files are copied to a new container for deployment.

Additionally, some output from a cv-lib method has been decreased in precision to fix a failing unit test in alpine.

Testing

The changes have been thoroughly tested with the following results:

  1. Successful Compilation: The project compiles and starts up successfully.
  2. Passing Unit Tests: All unit tests pass within the Alpine container.
  3. Dev Cluster Deployment: When deployed to the development cluster, the data gets processed as expected.

These updates are expected to contribute to a more efficient and streamlined development and deployment process.

dmccoystephenson and others added 21 commits July 20, 2023 13:39
Optimize Dockerfiles for Smaller and Faster Deployments
Update do_kafka_test to set DOCKER_HOST_IP
Update KAFKA_CONTAINER_NAME to resolve dynamically
…ot-changes

Sync CDOT develop branch with latest USDOT changes
Dockerfile-nsv Outdated
WORKDIR /cvdi-stream

# add runtime dependencies
RUN apk add --upgrade --no-cache \
Copy link
Contributor

@dan-du-car dan-du-car Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to COPY the libs from build image? The same comments for other Dockerfiles that install the same dependencies from build stage image.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dockerfiles have now been modified to include 3 image stages:

  1. runtime-deps: Image with runtime dependencies
  2. builder: Inherit from runtime-deps and build
  3. final: Inherit from runtime-deps and copy built files

This removes the need to install the runtime dependencies twice.

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the docker setup action

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been removed.

- name: Build
uses: docker/build-push-action@v3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove docker build/push action

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been removed.

Removed docker CI actions & reduced installation duplication in dockerfiles
@dmccoystephenson
Copy link
Contributor Author

This PR is ready for re-review.

@dan-du-car dan-du-car merged commit c22b9d3 into usdot-jpo-ode:develop Feb 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants