Skip to content

Commit

Permalink
Deploy documentation for tag v0.13.0 to github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions committed Jun 14, 2024
0 parents commit d1bbe46
Show file tree
Hide file tree
Showing 1,243 changed files with 41,024 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_build
.elixir_ls
deps
data
5 changes: 5 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
plugins: [Phoenix.LiveView.HTMLFormatter],
inputs: ["mix.exs", "config/*.exs"],
subdirectories: ["apps/*"]
]
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "mix"
directory: "/"
schedule:
interval: weekly

- package-ecosystem: "npm"
directory: "/apps/ex_nvr_web/assets"
schedule:
interval: weekly
40 changes: 40 additions & 0 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM hexpm/elixir:1.15.7-erlang-26.1.2-debian-bullseye-20231009-slim

# install build dependencies
RUN \
apt-get update && apt-get install -y \
wget \
xz-utils \
npm \
git \
make \
cmake \
libsrtp2-dev \
libturbojpeg-dev \
&& rm -rf /var/lib/apt/lists/*

ARG ERL_FLAGS
ENV ERL_FLAGS=$ERL_FLAGS
ENV MIX_ENV=prod
ENV GENERATE_DEB_PACKAGE=true

# Create build workdir
WORKDIR /app

# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force

# install mix dependencies
COPY mix.exs mix.lock ./
COPY config config
COPY assets assets
COPY apps apps
COPY rel rel

RUN mix deps.get
RUN mix deps.compile
RUN mix do release

RUN mkdir build-assets
RUN cp _build/prod/*.tar.gz _build/prod/*.deb build-assets/
45 changes: 45 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: docker

on:
push:
tags:
- 'v*'

jobs:
publish:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/evercam/ex_nvr

- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64/v8
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ERL_FLAGS=+JPperf true
85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-20.04
env:
MIX_ENV: prod
GENERATE_DEB_PACKAGE: true
steps:
- uses: actions/checkout@v3

- uses: erlef/setup-beam@v1.16
with:
otp-version: 26.1
elixir-version: 1.15.7

- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y install npm libsrtp2-dev libturbojpeg-dev

- name: Get deps
run: mix deps.get --only prod

- name: Create release
run: mix release

- name: Setup QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/arm64/v8
file: .github/workflows/Dockerfile
load: true
tags: ex_nvr:${{ github.ref_name }}-arm64
build-args: |
ERL_FLAGS=+JPperf true
- name: Copy release
run: |
id=$(docker create ex_nvr:${{ github.ref_name }}-arm64)
docker cp $id:/app/build-assets/. _build/prod/
docker rm -v $id
- name: Create GH release
uses: softprops/action-gh-release@v1
with:
name: ${{ github.ref_name }}
generate_release_notes: true
files: |
_build/prod/*.deb
_build/prod/*.tar.gz
publish-docs:
needs: [release]

runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Copy Documentation
run: cp apps/ex_nvr_web/priv/static/openapi.yaml docs/

- name: Deploy to GitHub Pages
run: |
git config user.name "GitHub Actions"
git config user.email "github-actions@github.com"
git checkout --orphan gh-pages
git add -A
git commit -m "Deploy documentation for tag ${{ github.ref_name }} to github pages"
git push origin gh-pages -f
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# The directory Mix will write compiled artifacts to.
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover/

# The directory Mix downloads your dependencies sources to.
/deps/

# Where 3rd-party dependencies like ExDoc output generated docs.
/doc/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Temporary files, for example, from tests.
/tmp/

/.elixir_ls/

/data/

/**/priv/bundlex

# Database files
*.db
*.db-*

# Object files
*.o
*.ko
*.obj
*.elf

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
83 changes: 83 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
FROM hexpm/elixir:1.15.7-erlang-26.1.2-alpine-3.18.4 AS build

# install build dependencies
RUN \
apk add --no-cache \
build-base \
npm \
git \
make \
cmake \
openssl-dev \
ffmpeg-dev \
clang-dev \
libsrtp-dev \
libjpeg-turbo-dev

ARG VERSION
ENV VERSION=${VERSION}
ENV DOCKER_BUILD=true

ARG ERL_FLAGS
ENV ERL_FLAGS=$ERL_FLAGS

# Create build workdir
WORKDIR /app

# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force

# set build ENV
ENV MIX_ENV=prod

# install mix dependencies
COPY mix.exs mix.lock ./
COPY config config
COPY assets assets
COPY apps apps
COPY rel rel

RUN mix deps.get
RUN mix deps.compile

# compile and build release
RUN mix do compile, release

# prepare release image
FROM alpine:3.18.5 AS app

# install runtime dependencies
RUN \
apk add --no-cache \
openssl \
ncurses-libs \
ffmpeg \
clang \
curl \
libsrtp \
libjpeg-turbo \
coreutils

WORKDIR /app

RUN mkdir /var/lib/ex_nvr
RUN chown nobody:nobody /app /var/lib/ex_nvr

USER nobody:nobody

COPY --from=build --chown=nobody:nobody /app/_build/prod/rel/ex_nvr ./

ENV HOME=/app

EXPOSE 4000

HEALTHCHECK CMD curl --fail http://localhost:4000 || exit 1

COPY --chown=nobody:nobody entrypoint.sh ./entrypoint.sh

RUN chmod +x entrypoint.sh

ENTRYPOINT ["./entrypoint.sh"]

CMD ["bin/ex_nvr", "start"]
Loading

0 comments on commit d1bbe46

Please sign in to comment.