Skip to content

Commit

Permalink
[CHORE] adding website container
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Takashi <[email protected]>
  • Loading branch information
nicolastakashi committed Jan 2, 2024
1 parent 2c89730 commit 60019cd
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: synchronize
synchronize:
@bash ./scripts/synchronize.sh
@sh ./scripts/synchronize.sh

.PHONY: website-install-depenencies
website-install-depenencies:
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
version: '3.9'
services:
website:
build:
context: .
dockerfile: ./website/Dockerfile
args:
- HUGO_BASEURL=http://localhost:5001
restart: unless-stopped
ports:
- "5001:80"
labels:
- "traefik.enable=true"
# The domain the service will respond to
- "traefik.http.routers.demo.rule=Host(`perses.dev`)"
- "traefik.http.routers.demo.tls.certresolver=myresolver"

demo:
image: "docker.io/persesdev/perses:main-2023-12-19-6a7acd38-distroless"
ports:
Expand Down
6 changes: 3 additions & 3 deletions scripts/synchronize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ROOT_DIR=$(pwd)
TAG_FILTER_RE="v(0|[1-9]\d*)\.([1-9]\d*).0"
GREP=$(which ggrep 2>/dev/null || which grep)
BASE_OUTPUT_DIR=$ROOT_DIR/website/content/docs
REPOS_DIR=$ROOT_DIR/repos/
REPOS_DIR=$ROOT_DIR/repos
MDOX_CONFIG=".mdox.yaml"

PERSES_REPO_URL="https://github.com/perses/perses"
Expand All @@ -19,7 +19,7 @@ rm -rf $REPOS_DIR && mkdir $REPOS_DIR
## This is useful for local development
## developers can set the USE_LOCAL_REPOSITORIES environment variable
## to use local repositories instead of cloning them from GitHub
if [[ -z "$USE_LOCAL_REPOSITORIES" ]]; then
if [ -z "$USE_LOCAL_REPOSITORIES" ]; then
git clone $PERSES_REPO_URL -b main --depth 1 $PERSES_REPO_DIR
else
# Check the operating system
Expand Down Expand Up @@ -87,7 +87,7 @@ result=$($ROOT_DIR/scripts/semver_compare.sh $release_number "0.42.0")

# We only care about the versions greater than 0.42.0
# Because the documentation for the versions less than 0.42.0 is not available
if [[ $result -eq 0 ]]; then
if [ $result -eq 0 ]; then
continue
fi

Expand Down
27 changes: 27 additions & 0 deletions website/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM golang:1.21 as synchronizer

COPY ./website ./website
COPY ./scripts ./scripts
COPY Makefile .
COPY .mdox.yaml .

RUN go install github.com/bwplotka/mdox@latest
RUN apt update && apt install -y git make

RUN make synchronize

FROM hugomods/hugo:exts as builder

ARG HUGO_BASEURL=
ENV HUGO_BASEURL=${HUGO_BASEURL}

COPY --from=synchronizer /go/website .

RUN npm install --ignore-scripts

RUN hugo --minify --gc --cleanDestinationDir

FROM hugomods/hugo:nginx

# Copy the generated files to keep the image as small as possible.
COPY --from=builder /src/public /site

0 comments on commit 60019cd

Please sign in to comment.