Work on the Dockerfile to run this application inside a container.

This commit is contained in:
Dave Smith-Hayes 2024-08-07 20:46:34 -04:00
parent 2749d463b5
commit a91ae2c18e
4 changed files with 34 additions and 16 deletions

15
.dockerignore Normal file
View File

@ -0,0 +1,15 @@
node_modules
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
Makefile
helm-charts
.env
.editorconfig
.idea
coverage*

View File

@ -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" ]

View File

@ -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.

View File

@ -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