Simple, single-user event aggregation platform, for use in personal websites and other related places.
event-streaming single-user events event-aggregation

🔧 Add Dockerfile and update docker-compose.yml

Jo 24106f21 4588cb53

+42
+1
.env.example
··· 1 1 PORT: 4300 2 2 MONGO_URI: "mongodb://localhost:27017/snowflake" 3 3 USER_TOKEN: "tOkEn123" 4 + NODE_ENV: "development"
+31
Dockerfile
··· 1 + FROM oven/bun:1 AS base 2 + WORKDIR /usr/src/app 3 + 4 + # install dependencies into temp directory 5 + # this will cache them and speed up future builds 6 + FROM base AS install 7 + RUN mkdir -p /temp/dev 8 + COPY package.json bun.lock /temp/dev/ 9 + RUN cd /temp/dev && bun install --frozen-lockfile 10 + 11 + # install with --production (exclude devDependencies) 12 + RUN mkdir -p /temp/prod 13 + COPY package.json bun.lock /temp/prod/ 14 + RUN cd /temp/prod && bun install --frozen-lockfile --production 15 + 16 + # copy node_modules from temp directory 17 + # then copy all (non-ignored) project files into the image 18 + FROM base AS prerelease 19 + COPY --from=install /temp/dev/node_modules node_modules 20 + COPY . . 21 + 22 + # copy production dependencies and source code into final image 23 + FROM base AS release 24 + COPY --from=install /temp/prod/node_modules node_modules 25 + COPY --from=prerelease /usr/src/app/package.json . 26 + COPY --from=prerelease /usr/src/app . 27 + 28 + # run the app 29 + USER bun 30 + EXPOSE 4300/tcp 31 + ENTRYPOINT [ "bun", "run", "prod" ]
+10
docker-compose.yml
··· 1 1 services: 2 + snowflake: 3 + build: 4 + context: . 5 + dockerfile: Dockerfile 6 + container_name: snowflake 7 + restart: always 8 + ports: 9 + - "4300:4300" 10 + env_file: .env 11 + 2 12 db: 3 13 image: mongo:latest 4 14 container_name: snowflake-db