James Fox
05/24/2020, 6:07 PMnpx ts-node --transpile-only src/schema
within a Docker container? The command doesn’t error for me, but the types are not generatedFROM node:12.13.0
# All this to pass the database url from parameter store
ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL
ARG NODE_ENV
ENV NODE_ENV=$NODE_ENV
RUN mkdir /app
WORKDIR /app
COPY . .
RUN yarn install --no-optional \
&& yarn cache clean --force \
&& chown -R node ./
USER node
RUN npx prisma generate
RUN npx ts-node --transpile-only src/schema
RUN npx tsc
ENTRYPOINT yarn prod
version: "3.7"
services:
backend:
image: backend
container_name: backend
ports:
- "8000:8000"
build:
context: .
dockerfile: Dockerfile
args:
- DATABASE_URL=${DATABASE_URL}
- NODE_ENV=${NODE_ENV:-production}
volumes:
- "./:/app/"
- ~/.aws/:/root/.aws:ro
Ryan
05/25/2020, 9:48 AMJames Fox
05/25/2020, 3:06 PMRyan
05/25/2020, 3:23 PMpackage.json
script?
Something like:
"generate:nexus": "ts-node --transpile-only src/schema"
And then run npm run generate:nexus
.James Fox
05/25/2020, 3:42 PMbuild
script just like the typescript graphql-apollo example (thats when i first encountered it not working)Ryan
05/25/2020, 3:51 PMDockerfile
with this and run as follows:
FROM node:12.13.0
# All this to pass the database url from parameter store
ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL
ARG NODE_ENV
ENV NODE_ENV=$NODE_ENV
RUN mkdir /app
WORKDIR /app
COPY . .
RUN yarn install --no-optional \
&& yarn cache clean --force
RUN npx prisma generate
RUN npx ts-node --transpile-only src/schema
RUN npx tsc
ENTRYPOINT yarn prod
James Fox
05/25/2020, 3:54 PMyarn cache clean
yesterday to no availRyan
05/25/2020, 3:56 PMJames Fox
05/25/2020, 3:56 PMUSER node
Ryan
05/25/2020, 3:58 PMFROM node:12.13.0
# All this to pass the database url from parameter store
ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL
ARG NODE_ENV
ENV NODE_ENV=$NODE_ENV
RUN mkdir /app
WORKDIR /app
COPY . .
RUN yarn install --no-optional \
&& yarn cache clean --force
RUN npx prisma generate
RUN mkdir -p src/generate
RUN npx ts-node --transpile-only src/schema
RUN npx tsc
ENTRYPOINT yarn prod
James Fox
05/25/2020, 3:59 PMRUN mkdir -p src/schema/generate
...
plugins: [
nexusPrismaPlugin({
outputs: {
typegen: __dirname + "/generated/nexusTypes.gen.ts",
},
}),
],
outputs: {
schema: __dirname + "/generated/schema.graphql",
typegen: __dirname + "/generated/typings.ts",
},
...
NODE_ENV=production
fails
NODE_ENV=development
succeedsNODE_ENV=production yarn build
Ryan
05/25/2020, 4:38 PMnpx ts-node --transpile-only src/schema
and not with the buildJames Fox
05/25/2020, 4:41 PMyarn build
command:
FROM node:12.13.0
# All this to pass the database url from parameter store
ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL
ARG NODE_ENV
ENV NODE_ENV=$NODE_ENV
RUN mkdir /app
WORKDIR /app
COPY . .
RUN yarn
# Run the tsc build in development mode so that the type definitions are emitted
RUN NODE_ENV=development yarn build
ENTRYPOINT yarn prod