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 checksum feature #6938

Closed
wants to merge 5 commits into from
Closed

Conversation

kindermax
Copy link

@kindermax kindermax commented Oct 4, 2019

This PR is intended to add a feature called checksum (may be changed).

It is a WIP (test will be written after we make sure the implementation is correct)

This is how it works.

  1. add to checksum list of files
webapp:
    image: webapp-dev
    build:
      dockerfile: ./docker/Dockerfile.webapp-dev
      checksum:
      - ./package.json
      - ./package-lock.json
      - ./docker/Dockerfile.webapp-dev
      context: .
    working_dir: /work
  1. If any of those files changed, rebuild the image

For now, I create file in ~/.docker/checksums.json. This place is chosen because I did not found any better place. If you know where is the better place - I will be glad to hear.

I am calculating the checksum for image and write it to checksums.json. Then I recalculate checksum on every run, and if something changed, update checksum and rebuild the image.

UPD. also i've added new command called checksum which calculates and prints same checksum as it will be used to make the decision to rebuild an image

usage:
docker-compose checksum my_service

- read checksums file or create
- check checksum for current service in file
- calculate new checksum
- build if checksum changed
@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "add-checksum-feature" [email protected]:kindritskyiMax/compose.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354237720
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

@kindermax
Copy link
Author

#6936 my issue

@kindermax kindermax closed this Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants