Skip to content

Commit

Permalink
Multistage docker (#396)
Browse files Browse the repository at this point in the history
Summary:
**Original Issue**: This dicussion started [here](flashlight/flashlight#225 (comment))

The main point of this PR is to update dockerfiles to use a multistage build, reducing build time and final image size. But it also adds to small but important features:

- `.dockerignore` to avoid passing unnecessary files to the build context
- `ccache` support to CMake

> I'm sure that most of the packages installed with apt on some builds and especially on the final image can be removed. But you know better which ones to take out. This would further reduce the final image size

| image                          | build-time | size   |
|--------------------------------|------------|--------|
| cpu-base-consolidation-latest  | 454.4s     | 4.76GB |
| cpu-latest                     | 433.6s     | 3.38GB |
| cuda-base-consolidation-latest | 970.3s     | 13.7GB |
| cuda-latest                    | 440.3s     | 9.31GB |

Pull Request resolved: flashlight/flashlight#396

Reviewed By: jacobkahn

Differential Revision: D25820782

Pulled By: tlikhomanenko

fbshipit-source-id: eef3d0550dee862d9bbfb24aa06f716c92ef75e8
  • Loading branch information
Alejandro Gaston Alvarez Franceschi authored and facebook-github-bot committed Jan 26, 2021
1 parent d7f035f commit f450c7c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -6,6 +6,10 @@ include(CTest)
include(CMakeDependentOption)

# ----------------------------- Setup -----------------------------
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
set(CMAKE_CXX_STANDARD 14)
Expand Down

0 comments on commit f450c7c

Please sign in to comment.