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

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

Merged
merged 1 commit into from Oct 30, 2019

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

@skwp skwp Feb 6, 2019

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 docker P3 labels Feb 7, 2019
Copy link
Collaborator

@guggero guggero left a comment

LGTM, thanks!

Copy link
Collaborator

@halseth halseth left a comment

LGTM 🗞

@halseth halseth merged commit 64e5d06 into lightningnetwork:master Oct 30, 2019
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker enhancement P3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants