From cb6e42096b28ec7c8baae142110fdca60534f3ab Mon Sep 17 00:00:00 2001 From: cirroskais Date: Mon, 18 Mar 2024 15:39:52 -0400 Subject: [PATCH] Initial commit --- .gitignore | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 38 +++++++++++ README.md | 15 +++++ bun.lockb | Bin 0 -> 3124 bytes package.json | 11 ++++ src/index.ts | 1 + tsconfig.json | 27 ++++++++ 7 files changed, 267 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100755 bun.lockb create mode 100644 package.json create mode 100644 src/index.ts create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9b1ee42 --- /dev/null +++ b/.gitignore @@ -0,0 +1,175 @@ +# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore + +# Logs + +logs +_.log +npm-debug.log_ +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Caches + +.cache + +# Diagnostic reports (https://nodejs.org/api/report.html) + +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# Runtime data + +pids +_.pid +_.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover + +lib-cov + +# Coverage directory used by tools like istanbul + +coverage +*.lcov + +# nyc test coverage + +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) + +.grunt + +# Bower dependency directory (https://bower.io/) + +bower_components + +# node-waf configuration + +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) + +build/Release + +# Dependency directories + +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) + +web_modules/ + +# TypeScript cache + +*.tsbuildinfo + +# Optional npm cache directory + +.npm + +# Optional eslint cache + +.eslintcache + +# Optional stylelint cache + +.stylelintcache + +# Microbundle cache + +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history + +.node_repl_history + +# Output of 'npm pack' + +*.tgz + +# Yarn Integrity file + +.yarn-integrity + +# dotenv environment variable files + +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) + +.parcel-cache + +# Next.js build output + +.next +out + +# Nuxt.js build / generate output + +.nuxt +dist + +# Gatsby files + +# Comment in the public line in if your project uses Gatsby and not Next.js + +# https://nextjs.org/blog/next-9-1#public-directory-support + +# public + +# vuepress build output + +.vuepress/dist + +# vuepress v2.x temp and cache directory + +.temp + +# Docusaurus cache and generated files + +.docusaurus + +# Serverless directories + +.serverless/ + +# FuseBox cache + +.fusebox/ + +# DynamoDB Local files + +.dynamodb/ + +# TernJS port file + +.tern-port + +# Stores VSCode versions used for testing VSCode extensions + +.vscode-test + +# yarn v2 + +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f0f2387 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +# use the official Bun image +# see all versions at https://hub.docker.com/r/oven/bun/tags +FROM oven/bun:1 as base +WORKDIR /usr/src/app + +# install dependencies into temp directory +# this will cache them and speed up future builds +FROM base AS install +RUN mkdir -p /temp/dev +COPY package.json bun.lockb /temp/dev/ +RUN cd /temp/dev && bun install --frozen-lockfile + +# install with --production (exclude devDependencies) +RUN mkdir -p /temp/prod +COPY package.json bun.lockb /temp/prod/ +RUN cd /temp/prod && bun install --frozen-lockfile --production + +# copy node_modules from temp directory +# then copy all (non-ignored) project files into the image +FROM base AS prerelease +COPY --from=install /temp/dev/node_modules node_modules +COPY . . + +# [optional] tests & build +ENV NODE_ENV=production +# RUN bun test +RUN bun run build + +# copy production dependencies and source code into final image +FROM base AS release +COPY --from=install /temp/prod/node_modules node_modules +COPY --from=prerelease /usr/src/app/index.ts . +COPY --from=prerelease /usr/src/app/package.json . + +# run the app +USER bun +EXPOSE 3000/tcp +ENTRYPOINT [ "bun", "run", "index.ts" ] diff --git a/README.md b/README.md new file mode 100644 index 0000000..1993b2e --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# garf-api + +To install dependencies: + +```bash +bun install +``` + +To run: + +```bash +bun run src/index.ts +``` + +This project was created using `bun init` in bun v1.0.29. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000000000000000000000000000000000000..8591e2fc319f309481f18d8dbdab51a432d8006e GIT binary patch literal 3124 zcmY#Z)GsYA(of3F(@)JSQ%EY!;{sycoc!eMw9K4T-L(9o+{6;yG6OCq1_p))YwiZw z8?Kgc+|WAHBFG}v_jCLtmMQF8WR_0&x_V>j!6n>4ML@s~p%^&O=msc18>WCEJ+UZF zH?bg-3n&A`4W2-n6G+d1(!D?$XlMgJBLf2ukOp$W>Lffiy5H$se&7_F=3Z}u#xK=x z($97Xy;fR$dPe2^tV@{_^`m;#w%S^9=Gz>56*z16eANaW?bg&JpfMByP$+Ic~^1;ikl7yz?B1E}8ys-Fd@5hhNo86fpQBN&*WdO`Ms_-s%bmcU>% zP#A0n>H7Zh{{tCJWx&V)F&Eir7U890X^$&TB^aJ{2n%U!mYI9ATJOZi!^XVx=dcH4 zwa!*6kM7UE(co+qX0&_8wWQ6P9(;Fy9%i
    2E*v7Y1g_vP@g{ zyK#k$&-Z6Y=7Pc-23Yo`2n8O$HEojCMft3EPhQ*#ee?2R$Flnc+luZQ{r3)=q|Cwp zZ|Aqb#g?H9!HJc_Wet)>%TQu!e)e3o~c{ zXjr(zXmXr@oQBEKKSK0ufR;r^pfs0FaZ$2fW?pegVor`8tj5&~DN0SXQ!p}6D9)@( z%}>)&Fi}X%$xP47PlJ{5|NcV&DBM8l@B`F94rnFBWm9TwWCzrT!vs)#fyxI^UIxWG z$P5dp-Vh?q0O^6512O|<7AU`UK+UiNR^%YSWfN^=7F%io^pzRhO@`>cg4FAeSk{Y;F8KrKd=3=FVV1FRLm#8_u!pl4{P zXAEmsz}g8w84EpAJwpR5dbA+UXMnXmU~LJY9#cIdGd&ZA4yX@LzI~XbTLO27uvhh%>lLDhpDJlZ!G7 zN*usUePF9Eqokyu*h*i&C^bE^xTL63FRvgst5`3;C|w_+NM9GER2LM|7J4P=RUi)7 z1U$OoYM`3I>cK`BS%S=fnx2=Rk_u&(7vnJwt_Emad9f}e{y^ps)&sHvs0&2tLQ(|8 z1*Lf@naP<1J%X$ZXbdt}7n~$a!9fC!J4k%taS|d5fJPxWK!Z&5j6mi