diff --git a/Dockerfile b/Dockerfile index 48ae773..ec4368c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,13 +2,16 @@ FROM oven/bun AS builder WORKDIR /app +ARG PUB_ENV ARG PUB_HOSTNAME ARG PUB_PLAUSIBLE_URL +ENV PUB_ENV=${PUB_ENV} ENV PUB_HOSTNAME=${PUB_HOSTNAME} ENV PUB_PLAUSIBLE_URL=${PUB_PLAUSIBLE_URL} COPY package.json ./ +COPY patches/ ./patches RUN bun install @@ -16,12 +19,8 @@ COPY . ./ RUN bun run build -FROM oven/bun:alpine +FROM nginx:stable-alpine -WORKDIR /app +COPY ./nginx.conf /etc/nginx/conf.d/default.conf -COPY --from=builder /app/build ./ - -EXPOSE 3000 - -CMD [ "bun", "run", "start" ] \ No newline at end of file +COPY --from=builder /app/build /usr/share/nginx/html \ No newline at end of file diff --git a/README.md b/README.md index 5c3d937..3961925 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ This will build the site to the `build` folder. You can then start the server wi Clone the repository, then build a Docker image with: ```shell $ docker build -t not-nullptr/vert \ + --build-arg PUB_ENV=production \ --build-arg PUB_HOSTNAME=vert.sh \ --build-arg PUB_PLAUSIBLE_URL=https://plausible.example.com . ``` diff --git a/docker-compose.yml b/docker-compose.yml index bd3476c..1758670 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,7 @@ services: args: PUB_HOSTNAME: "vert.sh" PUB_PLAUSIBLE_URL: "https://plausible.example.com" + PUB_ENV: "production" restart: unless-stopped ports: - - 3000:3000 \ No newline at end of file + - 3000:80 \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..c9214f9 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,12 @@ +server { + listen 80; + server_name vert; + + root /usr/share/nginx/html; + + client_max_body_size 10M; + + location / { + try_files $uri /index.html; + } +} \ No newline at end of file