Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: deno support #354

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
30 changes: 8 additions & 22 deletions .docker/dockerfiles/backend
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
FROM diamonds2_base:latest as base
FROM diamonds2_base:latest AS base
WORKDIR /app/packages/backend
RUN apk update && apk add --no-cache openssl libc6-compat
RUN apt-get update -y && apt-get install -y openssl
COPY --chown=1000:1000 packages/backend .

FROM base AS develop
ENV PORT=3000
RUN npm install -g ts-node typescript
# Add Prisma generate here
RUN npx prisma generate
RUN deno -A npm:prisma generate
EXPOSE $PORT
CMD ["yarn", "start:dev"]
CMD ["deno", "run", "start:dev"]

FROM develop AS build
RUN yarn
# Make sure Prisma is generated before build
RUN npx prisma generate
RUN npm run build

FROM node:20-alpine AS prod
FROM base AS prod
ENV PORT=3000
WORKDIR /app
COPY --chown=1000:1000 --from=build /app/packages/backend/dist ./dist
COPY --chown=1000:1000 --from=build /app/node_modules ./node_modules
COPY --chown=1000:1000 --from=build /app/packages ./packages
COPY --chown=1000:1000 --from=build /app/packages/backend/package.json ./package.json
COPY --chown=1000:1000 --from=build /app/packages/backend/prisma ./prisma
RUN npm install -g ts-node typescript
# Generate Prisma client in prod stage
RUN npx prisma generate
# Add Prisma generate here
RUN deno -A npm:prisma generate
EXPOSE $PORT
CMD ["npm", "run", "start:prod"]
CMD ["deno", "run", "start:prod"]
20 changes: 8 additions & 12 deletions .docker/dockerfiles/base
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
FROM node:20-alpine as base
FROM denoland/deno:2.0.6 AS base
WORKDIR /app
RUN chown 1000:1000 .

# Set yarn version
RUN yarn set version 3.6.3

# Copy root files
COPY --chown=1000:1000 package.json yarn.lock .yarnrc.yml ./

# Copy yarn files
COPY --chown=1000:1000 .yarn .yarn
COPY --chown=1000:1000 package.json deno.json deno.lock ./

# Copy package.jsons from packages
COPY --chown=1000:1000 packages/backend/package.json packages/backend/package.json
COPY --chown=1000:1000 packages/frontend/package.json packages/frontend/package.json
COPY --chown=1000:1000 packages/types/package.json packages/types/package.json

# Copy deno.jsons from packages
COPY --chown=1000:1000 packages/backend/deno.json packages/backend/deno.json
COPY --chown=1000:1000 packages/frontend/deno.json packages/frontend/deno.json
COPY --chown=1000:1000 packages/types/deno.json packages/types/deno.json

# Install node_modules
RUN yarn install || { cat /tmp/**/build.log; exit 1; }
RUN deno install --allow-scripts

# Copy package sources
COPY --chown=1000:1000 tsconfig.json ./
COPY --chown=1000:1000 packages packages
COPY --chown=1000:1000 scripts scripts

# Build packages
RUN npm run build
7 changes: 3 additions & 4 deletions .docker/dockerfiles/frontend
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
FROM diamonds2_base:latest as base
FROM diamonds2_base:latest AS base
WORKDIR /app/packages/frontend
COPY --chown=1000:1000 packages/frontend .

FROM base AS develop
ENV PORT=8082
EXPOSE $PORT
CMD ["yarn", "dev"]
CMD ["deno", "run", "dev"]

FROM develop AS build
RUN yarn
RUN npm run build
RUN deno run build

FROM nginx:1.18 AS prod
WORKDIR /usr/share/nginx/html/
Expand Down
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["denoland.vscode-deno"]
}
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"source.organizeImports": "explicit",
"source.sortMembers": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "denoland.vscode-deno",
"editor.formatOnSave": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
Expand All @@ -19,5 +19,8 @@
"typescript.preferences.importModuleSpecifier": "project-relative",
"typescript.preferences.importModuleSpecifierEnding": "minimal",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.updateImportsOnFileMove.enabled": "always"
"typescript.updateImportsOnFileMove.enabled": "always",
"deno.enable": true,
"deno.lint": true,
"eslint.enable": false
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/arg-npm-4.1.3-1748b966a8-969b491082.zip
Binary file not shown.
Binary file removed .yarn/cache/arg-npm-5.0.2-2f5805a547-92fe7de222.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/asap-npm-2.0.6-36714d439d-b244c0458c.zip
Binary file not shown.
Binary file removed .yarn/cache/asn1-npm-0.2.6-bdd07356c4-cf629291fe.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/bl-npm-4.1.0-7f94cdcf3f-b7904e66ed.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/bser-npm-2.1.1-cc902055ce-edba1b65ba.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading