From a91ae2c18e08d014fb4b25decdc7503d787963a2 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Wed, 7 Aug 2024 20:46:34 -0400 Subject: [PATCH] Work on the Dockerfile to run this application inside a container. --- .dockerignore | 15 +++++++++++++++ Dockerfile | 22 ++++++++++++++++------ README.md | 12 ++---------- src/index.tsx | 1 + 4 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f965aed --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +node_modules +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +README.md +LICENSE +.vscode +Makefile +helm-charts +.env +.editorconfig +.idea +coverage* diff --git a/Dockerfile b/Dockerfile index 55971b8..a721cbc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,18 @@ -FROM oven/bun:1 AS bas -WORKDIR /usr/src/blog +# tag it as build +FROM oven/bun AS build +WORKDIR /app -FROM bas AS install -RUN mkdir -p /temp/prod -COPY package.json bun.lockb /temp/prod/ -RUN cd /temp/prod && bun install --frozen-lockfile --production +COPY bun.lockb . +COPY package.json . +RUN bun install --frozen-lockfile +RUN mkdir src posts +COPY ./src ./src +COPY ./posts ./posts + +USER bun +EXPOSE 3000 + +CMD [ "bun", "run", "src/index.ts" ] +# CMD [ "ls", "-la", "src" ] +# CMD [ "pwd" ] diff --git a/README.md b/README.md index 6dd13e7..a7fb31b 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,3 @@ -To install dependencies: -```sh -bun install -``` +# davesmithhayes.com -To run: -```sh -bun run dev -``` - -open http://localhost:3000 +This repository holds the code that deploys into the blog for Dave Smith-Hayes. diff --git a/src/index.tsx b/src/index.tsx index 4381313..2e47499 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -38,6 +38,7 @@ app.use('/static/*', serveStatic({ app.route('/', home); app.route('/posts', posts); +console.log("Starting the blog application"); export default { port: process.env.APP_PORT || 3000, fetch: app.fetch