-
Notifications
You must be signed in to change notification settings - Fork 293
Fix --cache-dir with Docker #145
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
Changes from 1 commit
c0be594
fb15f0a
f4a5442
a7be23a
ba6ec09
a49b3b7
38dd31f
d856a85
2646bfb
ca40274
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ const path = require('path'); | |
const get = require('lodash.get'); | ||
const set = require('lodash.set'); | ||
const {spawnSync} = require('child_process'); | ||
const {quote} = require('shell-quote'); | ||
const values = require('lodash.values'); | ||
const {buildImage, getBindPath} = require('./docker'); | ||
|
||
|
@@ -87,19 +86,17 @@ function installRequirements(requirementsPath, targetFolder, serverless, service | |
cmdOptions.push('-e', 'SSH_AUTH_SOCK=/tmp/ssh_sock'); | ||
} | ||
if (process.platform === 'linux') { | ||
// Set the ownership of the .serverless/requirements folder to current user | ||
pipCmd = quote(pipCmd); | ||
const chownCmd = quote([ | ||
'chown', '-R', `${process.getuid()}:${process.getgid()}`, | ||
targetRequirementsFolder, | ||
]); | ||
pipCmd = ['/bin/bash', '-c', '"' + pipCmd + ' && ' + chownCmd + '"']; | ||
// Use same user so requirements folder is not root and so --cache-dir works | ||
cmdOptions.push('-u', `${process.getuid()}`); | ||
// const stripCmd = quote([ | ||
// 'find', targetRequirementsFolder, | ||
// '-name', '"*.so"', | ||
// '-exec', 'strip', '{}', '\;', | ||
// ]); | ||
// pipCmd = ['/bin/bash', '-c', '"' + pipCmd + ' && ' + stripCmd + ' && ' + chownCmd + '"']; | ||
} else if (process.platform === 'win32') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you change this to an empty else (or add macOS/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is Circle.CI configured to test on Mac OS X too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, AFAIK circle doesn't offer free mac os builds. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you be open to moving to Travis.CI? Mac builds are free there and I think they have a working Docker setup too. |
||
// Use same user so --cache-dir works | ||
cmdOptions.push('-u', '1000'); // TODO is this always the case? | ||
} | ||
cmdOptions.push(dockerImage); | ||
cmdOptions.push(...pipCmd); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cgrimal, AFAICT you added the
chown
stuff. Could you test this alternative?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW tests passed on Linux with all Docker tests enabled. There was no problem deleting the
.serverless
folder.