-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove serverless and dockerize api (#7)
* Remove AWS dynamo DB * Remove serverless, dockerize and fix API refactor bugs * Minor README changes * Docker comments * Allow configuring server port via docker * Fix symlinks * Fix PR comments
- Loading branch information
Showing
20 changed files
with
201 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# NOTE: Keep in sync with .gitignore. | ||
# | ||
# From: https://shisho.dev/blog/posts/how-to-use-dockerignore/ | ||
# | ||
# In .gitignore, the file or directory name is ignored in any hierarchy below the .gitignore file, but in .dockerignore, | ||
# all paths must be relative to the way where .dockerignore is located. However, in .dockerignore, all paths must be | ||
# listed relative to the path. | ||
**/.build | ||
**/.env | ||
**/.idea | ||
**/.log | ||
**/.serverless | ||
**/.tsbuildinfo | ||
**/.vscode | ||
**/build | ||
**/dist | ||
**/node_modules | ||
**/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
# NOTE: Keep in sync with .dockerignore | ||
.build | ||
.env | ||
.idea | ||
.log | ||
.serverless | ||
.tsbuildinfo | ||
.vscode | ||
.vscode | ||
build | ||
dist | ||
docker | ||
node_modules | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
HTTP_API_ID= | ||
MAX_BATCH_SIZE= | ||
MAX_BATCH_SIZE=10 | ||
PORT=8090 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
../../.eslintignore | ||
../../.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
../../.prettierignore | ||
../../.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Step 1: Build the TypeScript application. | ||
FROM node:18-alpine AS builder | ||
|
||
WORKDIR /usr/src/app | ||
# Assumes the context is the root of the monorepo. Copies all of the contents (without files listed in .dockerignore) of | ||
# the monorepo into the image. | ||
COPY . . | ||
RUN npm install -g pnpm | ||
# Installs all dependencies only for the api package. | ||
RUN pnpm install --recursive --filter api | ||
# Builds the api package. | ||
RUN pnpm run --filter api tsc | ||
|
||
# Step 2: Run the built application. | ||
FROM node:18-alpine | ||
|
||
WORKDIR /usr/src/app/packages/api | ||
# Copies the built application from the builder image. | ||
COPY --from=builder /usr/src/app/packages/api/dist ./dist | ||
# Copies the package.json from the builder image. | ||
COPY --from=builder /usr/src/app/packages/api/package.json . | ||
# This Dockerfile copies the pnpm-lock.yaml file from the monorepo root to install locked dependency versions. This | ||
# guarantees consistency by utilizing identical sets of dependencies. | ||
COPY pnpm-lock.yaml . | ||
RUN npm install -g pnpm | ||
# Only install dependencies for production (ignore "devDependecies" section in package.json). | ||
RUN pnpm install --prod | ||
|
||
EXPOSE 3000 | ||
CMD [ "node", "dist/src/local-server.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: '3.8' | ||
|
||
services: | ||
express-server: | ||
build: | ||
context: ../../../ | ||
dockerfile: ./packages/api/docker/Dockerfile | ||
ports: | ||
- '${PORT:-4000}:${PORT:-4000}' | ||
environment: | ||
- NODE_ENV=production | ||
- PORT=${PORT:-4000} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.