diff --git a/Dockerfile b/Dockerfile index 54256ceb..2be91f83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # build environment -FROM node:22-alpine as build +FROM node:22-alpine AS build WORKDIR /app # Install deps @@ -29,11 +29,11 @@ RUN rm -rf node_modules # Get RDS Certificate RUN apk update && apk add wget && rm -rf /var/cache/apk/* \ && wget "https://s3.amazonaws.com/rds-downloads/rds-ca-2019-root.pem" -ENV dbCertPath /app/rds-ca-2019-root.pem +ENV dbCertPath=/app/rds-ca-2019-root.pem ENV NODE_ENV=prod ENTRYPOINT ["/app/entrypoint.sh"] EXPOSE 4000 8080 -CMD ["yarn", "prod"] +CMD ["node", "dist/graphql/index.js"] diff --git a/infrastructure/prod/entrypoint.sh b/infrastructure/prod/entrypoint.sh index ddffb883..90a01405 100755 --- a/infrastructure/prod/entrypoint.sh +++ b/infrastructure/prod/entrypoint.sh @@ -1,7 +1,9 @@ #!/bin/sh cd dist -yarn install --production +# TODO: This should be a `yarn workspaces focus --production` but +# the dev and non-dev deps are a tangled mess rn +yarn workspaces focus yarn prod:db:migrate yarn db:refresh cd .. diff --git a/package.json b/package.json index 13ba5e09..39dd6a01 100644 --- a/package.json +++ b/package.json @@ -43,10 +43,8 @@ "dbtest": "jest -i --projects tests/database --verbose", "about:unittest": "//// Runs unit tests. Does not need db, elasticsearch, spun up. Does not need the Docker containers to be running.", "unittest": "jest -i --projects tests/unit --verbose", - "about:build_backend": "//// Compiles this project", - "build_backend": "rm -rf dist && mkdir -p dist && babel --extensions '.js,.ts' . -d dist/ --copy-files --ignore node_modules --ignore .git --include-dotfiles && rm -rf dist/.git", - "about:build": "//// Compiles this project, surpressing output", - "build": "yarn build_backend", + "about:build": "//// Compiles this project", + "build": "rm -rf dist && mkdir -p dist && babel --extensions '.js,.ts' . -d dist/ --copy-files --ignore node_modules --ignore .git --include-dotfiles && rm -rf dist/.git", "about:prod:scrape": "//// Runs the scrapers (same as `yarn scrape`, but on the compiled project)", "prod:scrape": "node dist/scrapers/main.js", "about:prod": "//// Runs the API (same as `yarn dev`, but on the compiled project)",