Skip to content

Commit 24e8dac

Browse files
authored
Updating function-to-app converter to depend on the @google-cloud/functions-framework module published to npm. (GoogleCloudPlatform#11)
1 parent 79d17e3 commit 24e8dac

File tree

7 files changed

+12
-35
lines changed

7 files changed

+12
-35
lines changed

converter/Dockerfile

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
1-
FROM gcr.io/gae-runtimes/nodejs10_app_builder:nodejs10_20190306_10_15_3_RC00 AS functions-framework
2-
3-
COPY *.js *.json LICENSE /functions-framework/
4-
COPY src /functions-framework/src
5-
COPY test /functions-framework/test
6-
WORKDIR /functions-framework
7-
RUN npm install --only=dev && npm run compile
8-
91
FROM gcr.io/gcp-runtimes/ubuntu_18_0_4
102

11-
# TODO: Once functions-framework npm module is published, do not include
12-
# functions-framework files in the image, just reference the published module in
13-
# package.json.
14-
COPY --from=functions-framework \
15-
/functions-framework/package.json \
16-
/functions-framework/LICENSE \
17-
/functions-framework/
18-
COPY --from=functions-framework \
19-
/functions-framework/build/src/*.js \
20-
/functions-framework/build/src/*.d.ts \
21-
/functions-framework/build/src/
22-
23-
# TODO: Once functions-framework files from the parent directory are not needed,
24-
# run docker build and copy files from the current directory.
25-
COPY converter/convert converter/.npmrc /converter/
3+
COPY convert .npmrc /converter/
264

27-
COPY converter/without-package /converter/without-package
28-
COPY converter/with-package-without-framework /converter/with-package-without-framework
29-
COPY converter/with-package-with-framework /converter/with-package-with-framework
5+
COPY without-package /converter/without-package
6+
COPY with-package-without-framework /converter/with-package-without-framework
7+
COPY with-package-with-framework /converter/with-package-with-framework
308

319
RUN apt-get update >/dev/null && \
3210
apt-get install -y jq >/dev/null

converter/convert

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ mv * ${temp_dir}
1212
mkdir functions
1313
mv ${temp_dir}/* functions
1414

15-
mv /functions-framework .
16-
1715
if [[ ! -f functions/package.json ]]; then
1816
echo 'Handling functions without package.json'
1917
cp /converter/without-package/package.json .

converter/generate-package-lock

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
set -e
88

99
for dir in without-package with-package-without-framework with-package-with-framework; do
10-
mkdir ${dir}/functions-framework
11-
cp ../package.json ${dir}/functions-framework/
1210
rm ${dir}/package-lock.json
1311
npm --prefix ${dir} --package-lock-only install
14-
rm -rf ${dir}/functions-framework
1512
rm -rf ${dir}/functions
1613
done

converter/with-package-without-framework/package-lock.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

converter/with-package-without-framework/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"@google-cloud/functions-framework": "file:functions-framework"
3+
"@google-cloud/functions-framework": "^1.0.0"
44
},
55
"scripts": {
66
"preinstall": "npm --prefix functions install",

converter/without-package/package-lock.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

converter/without-package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"dependencies": {
3-
"@google-cloud/functions-framework": "file:functions-framework"
3+
"@google-cloud/functions-framework": "^1.0.0"
44
},
55
"scripts": {
66
"start": "cd functions && functions-framework"

0 commit comments

Comments
 (0)