Skip to content

Commit

Permalink
chore: update deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
SebassNoob committed Oct 4, 2024
1 parent 500f90f commit 0f988a0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM oven/bun:1.1.29 AS build

WORKDIR /app
COPY . /app

RUN bun install
RUN bun run build

FROM ubuntu

RUN apt-get update
RUN apt-get install nginx -y

COPY --from=build /app/dist /var/www/html/
COPY nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ prettier: `bun run prettier`

build: `bun run build`

start: `docker build -t sebassnoob-blog .` and then `docker run -p 3001:80 -d sebassnoob-blog`. Open localhost:3001 to see the server.

### tests

requires docker. the test directory is `/cypress`.
Expand Down
22 changes: 22 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server {
listen 80;
server_name localhost;

root /var/www/html;
index index.html;

location / {
try_files $uri /index.html;
}

# Serve static files directly
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
try_files $uri =404;
}

# Optional: Gzip compression
gzip on;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
gzip_vary on;
gzip_min_length 1024;
}
2 changes: 1 addition & 1 deletion test.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM oven/bun:1.1.12
FROM oven/bun:1.1.29
WORKDIR /app

COPY . .
Expand Down

0 comments on commit 0f988a0

Please sign in to comment.