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

fix(lambda-nodejs): docker build is not working #10885

Merged
merged 6 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/@aws-cdk/aws-lambda-nodejs/parcel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG IMAGE=amazon/aws-sam-cli-build-image-nodejs12.x
FROM $IMAGE

# Install yarn
RUN npm install --global yarn
RUN npm install --global yarn@1.22.5

# Install parcel 2 (fix the version since it's still in beta)
# install at "/" so that node_modules will be in the path for /asset-input
Expand All @@ -19,4 +19,7 @@ RUN mkdir /tmp/npm-cache && \
# Disable npm update notifications
RUN npm config --global set update-notifier false

# create non root user and change allow execute command for non root user
RUN /sbin/useradd -u 1000 user && chmod 711 /

CMD [ "parcel" ]
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-lambda-nodejs/test/docker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ beforeAll(() => {
test('parcel is available', async () => {
const proc = spawnSync('docker', [
'run', 'parcel',
'sh', '-c',
'bash', '-c',
'$(node -p "require.resolve(\'parcel\')") --version',
]);
expect(proc.status).toEqual(0);
Expand All @@ -20,7 +20,7 @@ test('parcel is installed without a package-lock.json file', async () => {
// See https://github.com/aws/aws-cdk/pull/10039#issuecomment-682738396
const proc = spawnSync('docker', [
'run', 'parcel',
'sh', '-c',
'bash', '-c',
'test ! -f /package-lock.json',
]);
expect(proc.status).toEqual(0);
Expand All @@ -30,7 +30,7 @@ test('can npm install with non root user', async () => {
const proc = spawnSync('docker', [
'run', '-u', '1000:1000',
'parcel',
'sh', '-c', [
'bash', '-c', [
'mkdir /tmp/test',
'cd /tmp/test',
'npm i constructs',
Expand All @@ -43,7 +43,7 @@ test('can yarn install with non root user', async () => {
const proc = spawnSync('docker', [
'run', '-u', '500:500',
'parcel',
'sh', '-c', [
'bash', '-c', [
'mkdir /tmp/test',
'cd /tmp/test',
'yarn add constructs',
Expand Down