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 # tag it as build
WORKDIR /usr/src/blog FROM oven/bun AS build
WORKDIR /app
FROM bas AS install COPY bun.lockb .
RUN mkdir -p /temp/prod COPY package.json .
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
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: # davesmithhayes.com
```sh
bun install
```
To run: This repository holds the code that deploys into the blog for Dave Smith-Hayes.
```sh
bun run dev
```
open http://localhost:3000

View File

@ -38,6 +38,7 @@ app.use('/static/*', serveStatic({
app.route('/', home); app.route('/', home);
app.route('/posts', posts); app.route('/posts', posts);
console.log("Starting the blog application");
export default { export default {
port: process.env.APP_PORT || 3000, port: process.env.APP_PORT || 3000,
fetch: app.fetch fetch: app.fetch