Skip to content

Add source after installing apk packages to avoid breaking docker cache#2598

Merged
halseth merged 1 commit intolightningnetwork:masterfrom
skwp:docker-caching
Oct 30, 2019
Merged

Add source after installing apk packages to avoid breaking docker cache#2598
halseth merged 1 commit intolightningnetwork:masterfrom
skwp:docker-caching

Conversation

@skwp
Copy link
Contributor

@skwp skwp commented Feb 6, 2019

Currently, changing the source code causes the docker layer cache to break the caching of package installation (make, git, etc). This makes rebuilds of the container due to source code changes unnecessarily expensive.

If we execute the source COPY command as an individual command, after the installation of the OS packages, then rebuilds of the container will be much quicker.

Pull Request Checklist

  • [ x] If this is your first time contributing, we recommend you read the Code
    Contribution Guidelines
  • [ x] All changes are Go version 1.11 compliant
  • [ x] The code being submitted is commented according to the
    Code Documentation and Commenting section
  • [ x] For new code: Code is accompanied by tests which exercise both
    the positive and negative (error paths) conditions (if applicable)
  • [ x] For bug fixes: Code is accompanied by new tests which trigger
    the bug being fixed to prevent regressions
  • [ x] Any new logging statements use an appropriate subsystem and
    logging level
  • [ x] Code has been formatted with go fmt
  • [ x] For code and documentation: lines are wrapped at 80 characters
    (the tab character should be counted as 8 characters, not 4, as some IDEs do
    per default)
  • [ x] Running make check does not fail any tests
  • [ x] Running go vet does not report any issues
  • [ x] Running make lint does not report any new issues that did not
    already exist
  • [ x] All commits build properly and pass tests. Only in exceptional
    cases it can be justifiable to violate this condition. In that case, the
    reason should be stated in the commit message.
  • [ x] Commits have a logical structure ([see section 4.5, of the Code Contribution Guidelines])

Currently, changing the source code causes the docker layer cache to break the caching of package installation (make, git, etc).
If we execute the source COPY command as an individual command, then rebuilds of the container will be much quicker.
make

# Copy in the local repository to build from.
COPY . /go/src/github.com/lightningnetwork/lnd
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 only change in this PR is moving the COPY line after the RUN apk add

@Roasbeef Roasbeef added enhancement Improvements to existing features / behaviour docker Docker-related PRs/Issues P3 might get fixed, nice to have labels Feb 7, 2019
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Contributor

@halseth halseth left a comment

Choose a reason for hiding this comment

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

LGTM 🗞

@halseth halseth merged commit 64e5d06 into lightningnetwork:master Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker-related PRs/Issues enhancement Improvements to existing features / behaviour P3 might get fixed, nice to have

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants