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

apify push should honor .dockerignore instead of .gitignore - to allow compiled languages #170

Closed
VaclavSynacek opened this issue May 4, 2020 · 2 comments · May be fixed by #172
Closed

Comments

@VaclavSynacek
Copy link

Currently apify push pushes all files except those in .gitignore and .git directory. This is fine default behavior for interpreted languages, but not so much for compiled languages.

The usual docker building workflow with compiled languages is to have in .gitignore all results of compilation and have different set of files used for docker image building as defined in .dockerignore. Typically the .dockerignore would differ from .gitignore that it would ignore all sources but it would include compilation result.

There are ugly workarounds for the current apify push:

  • commit compilation results and have sources needlessly included in the actor docker
  • manually update gitignore everytime before apify push

but these are both really ugly.

This I believe is applicable to all compiled languages. And as apify is mostly for JavaScript it seems like a rare edge case. But hey, don't you want to welcome compiled languages too?

A specific example is minimal actor in ClojureScript I made: https://github.com/VaclavSynacek/apify-cljs-whats-my-name . ClojureScript is a compile-to-JavaScript language (but all of above is applicable also for compile-to-binary languages). In this example, ideally the compiled/main.js file would be included in the actor and src directory containing cljs source files (which the platform cannot understand anyway) does not need to be included. This is reflected in the .dockerignore file. But apify push only honors .gitignore so pushing this actor as-is will not work. If I manually change the .gitignore to not ignore compiled and to do ignore src than apify push pushes correct actor that actually does work.

@drobnikj
Copy link
Member

Hey @VaclavSynacek,

thanks for the report.

I got your point, but you have to think about apify push like git push which pushes your source code to apify platform. In this case, it makes sense to have all code on apify platform and view it in UI.

Of course, there is a bonus of apify push which build your actor. But the build is simple docker build command and it follows .dockerignore.

@VaclavSynacek
Copy link
Author

Hello @drobnikj,
maybe (mis)using .dockerignore is neither a good idea. But I still see the need to sometimes have different set of files in git and in apify. Especially for the compiled languages.

How about having an .apifyignore file that would overwrite .gitignore if it exists. If it does not, than fall back to current behaviour. Pull request for this attached.

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 a pull request may close this issue.

2 participants