Skip to content

Improve Docker build #239

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

Closed
wants to merge 1 commit into from
Closed

Improve Docker build #239

wants to merge 1 commit into from

Conversation

mering
Copy link
Contributor

@mering mering commented Jun 21, 2023

Fixes #158
Fixes #235

Copy link
Collaborator

@mikelalcon mikelalcon left a comment

Choose a reason for hiding this comment

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

I don't know much about docker, but the deletion of this seems that would break existing users:

COPYBARA_CONFIG=copy.bara.sky`

  • allows you to specify a path to a config file, defaults to root copy.bara.sky
  • COPYBARA_SUBCOMMAND=migrate
    • allows you to change the command run, defaults to migrate
  • COPYBARA_OPTIONS=''
    • allows you to specify options for copybara, defaults to none
  • COPYBARA_WORKFLOW=default
    • allows you to specify the workflow to run, defaults to default
  • COPYBARA_SOURCEREF=''

@mering
Copy link
Contributor Author

mering commented Jun 22, 2023

If you want to handle environment arguments, this should definitely done by the executable itself. Adding this as a script to the container, feels like a big hack.

Nevertheless, I added that functionality back to not break existing users for the time being.

@mering mering requested a review from mikelalcon July 5, 2023 18:08
@mering
Copy link
Contributor Author

mering commented Aug 23, 2023

@mikelalcon PTAL

COPY --from=build /tmp/copybara/ /opt/copybara/
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add comment on why remove.

Copy link
Collaborator

Choose a reason for hiding this comment

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

IIUC this is the equivalent to "apt-get clean". Any reason for using this instead?

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 is suggested as best practice from Docker itself: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get

This is basically what is used in more than 99% of all Dockerfiles. Should I still add a comment?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, at least in the commit description. Can you: squash all changes in one and add a commit description that explains all we are doing here?

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@mering mering requested a review from mikelalcon September 12, 2023 13:35
This allows passing args to Copybara directly via CMD
as an alternative to using environment variables.
@mering mering deleted the docker-cmd branch September 14, 2023 14:26
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.

Docker entrypoint script fails when no COPYBARA_OPTIONS flag passed Docker entrypoint does not pass on command line arguments
2 participants