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

Improve Docker build #239

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
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

Dockerfile Outdated Show resolved Hide resolved
@mering mering force-pushed the docker-cmd branch 2 times, most recently from ea3a306 to 582a1bf Compare September 12, 2023 13:13
This allows passing args to Copybara directly via CMD
as an alternative to using environment variables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants