Comments (14)
I have looked little more into at and found out there is no ENV_DIR to pass on. The host machine has the file /home/dokku/<app name>/ENV
with lines like export MY_VAR=something
and the dokku script copies that into <container>/app/.profile.d/app-env.sh
in the release
phase - so the ENV is not available in the container during build/compile.
I guess that one way to "fix" this would be to propagate ENV to the container already before /build/builder
is invoked and source it before executing builder
or have builder
sourcing it itself. The question is if we want to make all vars available at compile time (or only some of them).
Some background: Clojure code may contain macros that may be executed at compile time - and some macros may depend on the environment (f.ex. needing a path to a directory with template files).
from buildstep.
@jakubholynet Are you using dokku? If yes one of these plugins might help you:
https://github.com/musicglue/dokku-user-env-compile
https://github.com/motin/dokku-user-env-compile
See: https://github.com/progrium/dokku/wiki/Plugins
from buildstep.
Thank you very much! Yes, I use Dokku. I will check out the plugins.
from buildstep.
Note: the Dokku plugins mirror the now deprecated Heroku lab feature user-env-compile, that has been replaced by the ENV_DIR
argument as described on that page an in the Heroku Buildpack API.
It would be nice if Dokku replicated the change.
from buildstep.
I'd accept a PR for it on dokku's side
from buildstep.
Great!
What would be a good implementation? I suppose that we want to keep the ENV
file for backwards compatibility so enhancing dokku build
to create /app/.env.d/
with a file for each env var based on parsing ENV
would be likely a good solution?
from buildstep.
Is there any chance we could then load these env vars into /exec? Any reason that wouldn't be a good idea?
from buildstep.
@jakubholynet I don't know about putting it in /app
- I think it would make more sense to put it in a top-level directory like /cache
, which gets removed (as a volume or as part of the docker run
command) immediately after building (and then not touching /app/.profile.d/app-env.sh
).
Anyway, if you're putting it in, say, /env
, then you could do something like this for Dokku without changing the ENV format:
docker run progrium/buildstep bash -c "
`sed 's/^export \([^=]\)=\(.*\)$/echo \2 > /env/\1/' <"$APP_DIR/ENV"`
/builder/build
# and, optionally
rm -rf /env"
from buildstep.
Anyway, the way we're looking at doing this in plushu/plusku, it would be best if /build/builder looked for a /env
directory, then called compile
with it as a third parameter if it's present. (Alternately, it could just mkdir -p /env
and let the buildpack freak out if nobody populated /env
, which would probably be at least as smooth as the behavior when $3 is undefined.)
from buildstep.
ENV_DIR for buildpacks is supported in the herokuish branch here. Can you try against that version?
from buildstep.
Nice. It is not easy for me anymore to try this out since I am away from the project where I experienced the problem but I will try to find the time to try to replicate it.
from buildstep.
Thank you :)
from buildstep.
BTW, the ENV_DIR is also supported in the current buildstep image, no idea if dokku etc. are using it though..
from buildstep.
@yabawock Yes, Dokku supports ENV_DIR since dokku/dokku@7d5e0ba
from buildstep.
Related Issues (20)
- /build/compile.sh: line 24: cd: /app: Permission denied HOT 31
- Provide extendable docker image HOT 4
- Update Ruby Buildpack HOT 2
- Non root user "breaks" dokku-volume HOT 11
- run tests in docker container HOT 3
- chown in /start -- is it necessary? HOT 17
- Problem with ddollar buildpack(s) HOT 5
- Update node.js buildpack for io.js fork
- Security rethink - separate users for build and run HOT 1
- NioGroovyMethods not loaded in grails app HOT 2
- heroku-buildpack-php newrelic segfaults? HOT 14
- latest nodejs buildpack fails with permission denied HOT 6
- Update Docker Hub image when Base Image is updated HOT 1
- dotnet-buildpack fails on dokku HOT 11
- Link to "officially support list of buildpack" broken HOT 1
- Python wheel deployment HOT 1
- How to install custom apt packages?
- [DEPRECATED] This script is outdated and was originally for demo purposes. It will be removed soon. HOT 1
- Add me as collaborator to this repo HOT 2
- Problem with starting build HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from buildstep.