mirror of https://github.com/VERT-sh/VERT.git
Update Docker image and add workflow (#35)
* feat: add local notice to readme * Improved readme * chore: update logo * Remove lockfile from gitignore * fix(docker): update docker image * Add missing PUB_ENV environment variable * Copy `patches/` folder during build * Use nginx for serving files Co-authored-by: GitGitro <108683123+GitGitro@users.noreply.github.com> * ci: add docker image workflow * [no ci] docs(readme): update example docker image tag Use the organization name instead of not-nullptr * chore(compose): set image name * fix(nginx): enable cross-origin isolation * [no ci] docs(readme): missed one --------- Co-authored-by: nullptr <62841684+not-nullptr@users.noreply.github.com> Co-authored-by: RealmyTheMan <163438634+RealmyTheMan@users.noreply.github.com> Co-authored-by: JovannMC <jovannmc@femboyfurry.net> Co-authored-by: GitGitro <108683123+GitGitro@users.noreply.github.com>
This commit is contained in:
parent
8437a9857d
commit
18ad1a8e0f
|
@ -0,0 +1,14 @@
|
|||
name: Docker Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build the Docker image
|
||||
run: docker build . --file Dockerfile --tag VERT-sh/vert:$(date +%s)
|
13
Dockerfile
13
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" ]
|
||||
COPY --from=builder /app/build /usr/share/nginx/html
|
|
@ -56,14 +56,15 @@ 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 \
|
||||
$ docker build -t VERT-sh/vert \
|
||||
--build-arg PUB_ENV=production \
|
||||
--build-arg PUB_HOSTNAME=vert.sh \
|
||||
--build-arg PUB_PLAUSIBLE_URL=https://plausible.example.com .
|
||||
```
|
||||
|
||||
You can then run it by using:
|
||||
```shell
|
||||
$ docker run --restart unless-stopped -p 3000:3000 -d --name "vert" not-nullptr/vert
|
||||
$ docker run --restart unless-stopped -p 3000:3000 -d --name "vert" VERT-sh/vert
|
||||
```
|
||||
|
||||
We also have a `docker-compose.yml` file available. Use `docker compose up` if you want to start the stack, or `docker compose down` to bring it down. You can pass `--build` to `docker compose up` to rebuild the Docker image (useful if you've changed any of the environment variables) as well as `-d` to start it in dettached mode. You can read more about Docker Compose in general [here](https://docs.docker.com/compose/intro/compose-application-model/).
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
services:
|
||||
vert:
|
||||
container_name: vert
|
||||
image: VERT-sh/vert:latest # will build under this name
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
PUB_HOSTNAME: "vert.sh"
|
||||
PUB_PLAUSIBLE_URL: "https://plausible.example.com"
|
||||
PUB_ENV: "production"
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 3000:3000
|
||||
- 3000:80
|
|
@ -0,0 +1,16 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name vert;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
client_max_body_size 10M;
|
||||
|
||||
add_header Cross-Origin-Embedder-Policy "require-corp";
|
||||
add_header Cross-Origin-Opener-Policy "same-origin";
|
||||
add_header Cross-Origin-Resource-Policy "cross-origin";
|
||||
|
||||
location / {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue