This commit is contained in:
Skillz4Killz
2023-04-05 21:08:08 +00:00
6 changed files with 1224 additions and 7 deletions
+24
View File
@@ -0,0 +1,24 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"decorators": true,
"dynamicImport": true
},
"transform": {
"legacyDecorator": true,
"decoratorMetadata": true
},
"target": "es2022",
"keepClassNames": true,
"loose": true
},
"module": {
"type": "es6",
"strict": false,
"strictMode": true,
"lazy": false,
"noInterop": false
},
"sourceMaps": true
}
+1
View File
@@ -0,0 +1 @@
nodeLinker: node-modules
+48
View File
@@ -0,0 +1,48 @@
# we node 18 alpine 3.17 as base image
# we use multi stage build in this file
# deps: contain all dependencies including dev dependencies
# builder: contains all compiled files
# prod-deps: contains only dependencies excluding dev dependencies
# runner: the final image, with only the dependencies and compiled files
FROM node:18.15.0-alpine3.17 AS deps
WORKDIR /app
# copy necessary for install dependencies
COPY package.json yarn.lock ./
# install dependencies
RUN yarn install
# use node alpine as base image
FROM node:18.15.0-alpine3.17 as builder
# copy the dependencies (node_modules) from the deps image
COPY --from=deps /app /app
WORKDIR /app
# copy the source files
COPY src/ src/
# copy the compiler config
COPY .swcrc ./
# compile the files
RUN yarn build
FROM node:18.15.0-alpine3.17 AS prod-deps
WORKDIR /app
# copy necessary for install dependencies
COPY package.json yarn.lock .yarnrc.yml ./
# config yarn to install only prod dependencies
RUN yarn set version berry
RUN yarn plugin import workspace-tools
# install prod dependencies
RUN yarn workspaces focus --all --production
FROM node:18.15.0-alpine3.17 as runner
# copy the compiled files from the builder image
COPY --from=builder /app/dist /app/dist
# copy the prod dependencies (node_modules) from the prod-deps image
COPY --from=prod-deps /app/node_modules /app/node_modules
WORKDIR /app
# copy necessary files
COPY package.json ./
# open port 8000
EXPOSE 8000
# set default command
CMD ["yarn" ,"start"]
+8 -1
View File
@@ -1,11 +1,18 @@
{
"name": "rest",
"packageManager": "yarn@3.3.0",
"type": "module",
"scripts": {
"build": "swc src --delete-dir-on-start --out-dir dist",
"start": "node ./dist/index.js"
},
"packageManager": "yarn@3.5.0",
"dependencies": {
"@discordeno/rest": "latest",
"express": "^4.18.2"
},
"devDependencies": {
"@swc/cli": "^0.1.57",
"@swc/core": "^1.3.21",
"@types/express": "^4"
}
}
+2 -2
View File
@@ -38,6 +38,6 @@ app.all('/*', async (req, res) => {
}
})
app.listen(process.env.REST_PORT, () => {
console.log(`REST listening on port #${process.env.REST_PORT!}`)
app.listen(8000, () => {
console.log(`REST listening on port #8000`)
})
+1141 -4
View File
File diff suppressed because it is too large Load Diff