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 generatedJames Fox
05/24/2020, 6:07 PMJames Fox
05/24/2020, 6:10 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 \
&& chown -R node ./
USER node
RUN npx prisma generate
RUN npx ts-node --transpile-only src/schema
RUN npx tsc
ENTRYPOINT yarn prod
James Fox
05/24/2020, 6:10 PMversion: "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 PMJames Fox
05/25/2020, 3:07 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)James Fox
05/25/2020, 3:45 PMJames Fox
05/25/2020, 3:46 PMJames Fox
05/25/2020, 3:48 PMJames Fox
05/25/2020, 3:50 PMRyan
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 PMJames 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
James Fox
05/25/2020, 3:56 PMJames Fox
05/25/2020, 3:56 PMJames Fox
05/25/2020, 3:57 PMRyan
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 PMJames Fox
05/25/2020, 3:59 PMRUN mkdir -p src/schema/generate
James Fox
05/25/2020, 4:01 PMJames Fox
05/25/2020, 4:01 PM...
plugins: [
nexusPrismaPlugin({
outputs: {
typegen: __dirname + "/generated/nexusTypes.gen.ts",
},
}),
],
outputs: {
schema: __dirname + "/generated/schema.graphql",
typegen: __dirname + "/generated/typings.ts",
},
...
James Fox
05/25/2020, 4:21 PMNODE_ENV=production
fails
NODE_ENV=development
succeedsJames Fox
05/25/2020, 4:22 PMNODE_ENV=production yarn build
James Fox
05/25/2020, 4:26 PMJames Fox
05/25/2020, 4:28 PMJames Fox
05/25/2020, 4:28 PMRyan
05/25/2020, 4:38 PMnpx ts-node --transpile-only src/schema
and not with the buildJames Fox
05/25/2020, 4:41 PMJames Fox
05/25/2020, 4:41 PMJames Fox
05/25/2020, 4:55 PMJames Fox
05/25/2020, 5:27 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