diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index e20147a..0000000 --- a/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -# IMPORTANT: run from root of monolithic repo - -FROM ubuntu - -WORKDIR /app - -COPY ./package.json . - -COPY ./packages/api/package.json ./packages/api/ - -# copy the core private package -COPY ./packages/core ./packages/core -COPY ./packages/core/package.json ./packages/core/ -# run and compile the core package -WORKDIR /app/packages/core -# todo: might not need this and just do from level higher -RUN yarn install - -WORKDIR /app/packages/api - -# copy all of the source code -COPY ./dist ./packages/api -RUN yarn install --production - -# steps -# 1. compile all dependencies -# add the \ No newline at end of file diff --git a/packages/api/.dockerignore b/packages/api/.dockerignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/packages/api/.dockerignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/packages/api/.gcloudignore b/packages/api/.gcloudignore new file mode 100644 index 0000000..4d7d693 --- /dev/null +++ b/packages/api/.gcloudignore @@ -0,0 +1,17 @@ +# This file specifies files that are *not* uploaded to Google Cloud +# using gcloud. It follows the same syntax as .gitignore, with the addition of +# "#!include" directives (which insert the entries of the given .gitignore-style +# file at that point). +# +# For more information, run: +# $ gcloud topic gcloudignore +# +.gcloudignore +# If you would like to upload your .git directory, .gitignore file or files +# from your .gitignore file, remove the corresponding line +# below: +.git +.gitignore + +# Node.js dependencies: +node_modules/ \ No newline at end of file diff --git a/packages/api/Dockerfile b/packages/api/Dockerfile new file mode 100644 index 0000000..e7f7a23 --- /dev/null +++ b/packages/api/Dockerfile @@ -0,0 +1,27 @@ +# IMPORTANT: run from root of monolithic repo +FROM ubuntu + +WORKDIR /app + +# The global package.json only contains build dependencies +COPY ./package.json . +COPY ./yarn.lock . + +# copy the source coded needed for all dependencies +COPY ./packages/core packages/core +COPY ./packages/api packages/api + +# run and compile the core package +WORKDIR /app/packages/core +# todo: might not need this and just do from level higher +RUN yarn install + +WORKDIR /app/packages/api +RUN yarn install --production +RUN yarn build + +CMD ["yarn", "start"] + + +# docker build -t talksik/nirvana-api:1.0 +# docker run -p 5000:8080 -d \ No newline at end of file diff --git a/packages/api/app.yaml b/packages/api/app.yaml new file mode 100644 index 0000000..7fde67a --- /dev/null +++ b/packages/api/app.yaml @@ -0,0 +1 @@ +runtime: nodejs14 diff --git a/packages/api/package.json b/packages/api/package.json index 9f9cd9a..de953ad 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -5,6 +5,8 @@ "license": "MIT", "scripts": { "dev": "NODE_ENV=development nodemon", + "start": "node dist/index.js", + "gcp-build": "tsc -p .", "start:dev": "ts-node index.ts", "production": "NODE_ENV=production nodemon" },