diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d2176d6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM oven/bun:1 +WORKDIR /usr/src/app +COPY src/ src/ +COPY bun.lockb . +COPY package.json . +COPY tsconfig.json . +RUN bun install --production --frozen-lockfile +EXPOSE 8081/tcp +ENTRYPOINT [ "/bin/bash", "-c" ] +CMD ["bun run src/index.ts"] \ No newline at end of file diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000..d58ef4d --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,7 @@ +FROM oven/bun:1 +WORKDIR /usr/src/app +COPY . . +RUN bun install +EXPOSE 8081/tcp +ENTRYPOINT [ "/bin/bash", "-c" ] +CMD ["bun --hot run src/index.ts"] \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index 7043347..c74810a 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/compose.yml b/compose.yml index 9c48217..aeeba95 100644 --- a/compose.yml +++ b/compose.yml @@ -26,11 +26,9 @@ services: JWTSECRET: "cooljwtsecret" fe-middleware: - image: oven/bun:1 + build: + dockerfile: Dockerfile.dev container_name: fe-middleware - entrypoint: /bin/bash -c - command: ["bun --hot run src/index.ts"] - working_dir: /usr/src/app ports: - "8081:8081" depends_on: @@ -40,8 +38,6 @@ services: BOT_API_URI: "http://bot-api:8080" GELBOORU_IMAGES_PER_REQUEST: 100 # Number of images per request, maximum 100 GELBOORU_TAGS: "2girls sleeping" # Tags of the images. The images will have all of these tags - volumes: - - ./:/usr/src/app:ro volumes: mongodb_data: diff --git a/package.json b/package.json index 8b9f352..e37c384 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "scripts": { "start": "bun run src/index.ts", - "dev": "docker compose down -v && docker compose up", - "test": "docker compose down -v && docker compose run fe-middleware 'sleep 5 && bun test'" + "dev": "docker compose down -v && docker compose up --build", + "test": "docker compose down -v && docker compose run --build fe-middleware 'pwd && ls && sleep 5 && bun test'" } }