Skip to content

Commit

Permalink
added: dockerfile & dockerignore
Browse files Browse the repository at this point in the history
  • Loading branch information
LovelessCodes committed May 8, 2024
1 parent 599887b commit 72837c4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
Makefile
helm-charts
.env
.editorconfig
.idea
coverage*
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Use the official Node.js image as the base image
FROM oven/bun:1 as base

# Set the working directory inside the container
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/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production

# [optional] tests & build
ENV NODE_ENV=production
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 .

USER bun

# Expose the port that the application will be listening on
EXPOSE 3000/tcp

# Run the application
ENTRYPOINT [ "bun", "run", "index.ts" ]

0 comments on commit 72837c4

Please sign in to comment.