Skip to content

Commit

Permalink
Merge pull request #2 from BritishGeologicalSurvey/edmond/update
Browse files Browse the repository at this point in the history
Update prez-ui to 3.8.0
  • Loading branch information
KoalaGeo authored Jan 25, 2024
2 parents 1f38866 + 90938db commit 5299e16
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 19 deletions.
40 changes: 24 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
ARG PREZ_UI_HOME=/prez-ui

FROM docker.io/node:18-alpine3.16 AS builder

RUN apk update && \
apk add \
bash \
git

WORKDIR /app
WORKDIR /

ARG PREZ_UI_HOME
ENV PREZ_UI_HOME=${PREZ_UI_HOME}

COPY PREZ_UI_GIT_TAG /tmp/PREZ_UI_GIT_TAG

RUN git init && \
git remote add origin https://github.com/RDFLib/prez-ui.git && \
# Pin to git tag version.
git fetch --depth 1 origin refs/tags/$(cat /tmp/PREZ_UI_GIT_TAG):refs/tags/$(cat /tmp/PREZ_UI_GIT_TAG) && \
git checkout tags/$(cat /tmp/PREZ_UI_GIT_TAG)
RUN export PREZ_UI_VERSION=$(cat /tmp/PREZ_UI_GIT_TAG) \
&& wget -O prez-ui.zip https://github.com/RDFLib/prez-ui/releases/download/v${PREZ_UI_VERSION}/prez-ui-${PREZ_UI_VERSION}.zip \
&& unzip prez-ui.zip

COPY public/ /app/public
WORKDIR ${PREZ_UI_HOME}

COPY public/ ${PREZ_UI_HOME}/public

# Strip out Prez UI header and footer placeholders.
RUN sed -i 's+<header id="header"></header>+<div id="header"></div>+g' /app/index.html
RUN sed -i 's+<footer id="footer"></footer>+<div id="footer"></div>+g' /app/index.html
RUN sed -i 's+<header id="header"></header>+<div id="header"></div>+g' ${PREZ_UI_HOME}/index.html
RUN sed -i 's+<footer id="footer"></footer>+<div id="footer"></div>+g' ${PREZ_UI_HOME}/index.html

# Add custom header and footer.
RUN mv /app/src/App.vue /app/src/PrezApp.vue
COPY custom-vues/App.vue /app/src/App.vue
# # Add custom header and footer.
RUN mv ${PREZ_UI_HOME}/src/App.vue ${PREZ_UI_HOME}/src/PrezApp.vue
COPY components/App.vue ${PREZ_UI_HOME}/src/App.vue

# Add custom VocPrez page.
COPY custom-vues/views/VocPrezHomeView.vue /app/src/views/vocprez/VocPrezHomeView.vue
COPY custom-vues/views/AboutView.vue /app/src/views/vocprez/AboutView.vue
COPY custom-vues/views/HomeView.vue /app/src/views/vocprez/HomeView.vue
COPY custom-vues/views/VocPrezHomeView.vue ${PREZ_UI_HOME}/src/views/vocprez/VocPrezHomeView.vue
COPY custom-vues/views/AboutView.vue ${PREZ_UI_HOME}/src/views/vocprez/AboutView.vue
COPY custom-vues/views/HomeView.vue ${PREZ_UI_HOME}/src/views/vocprez/HomeView.vue

RUN rm .env

Expand All @@ -37,12 +42,15 @@ RUN npm ci && npm run build
# ---
FROM docker.io/nginx:1.23-alpine

ARG PREZ_UI_HOME
ENV PREZ_UI_HOME=${PREZ_UI_HOME}

RUN apk add --no-cache bash

RUN mkdir /app

COPY ./docker_entrypoint.sh ./.env ./
COPY --from=builder /app/dist /app
COPY --from=builder ${PREZ_UI_HOME}/dist /app
COPY ./nginx.conf /etc/nginx/nginx.conf

RUN chmod +x /docker_entrypoint.sh
Expand Down
2 changes: 1 addition & 1 deletion PREZ_UI_GIT_TAG
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.7.2
3.8.0
4 changes: 4 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
version: "3"

tasks:
stack:build:
cmds:
- docker-compose --progress plain --profile stack build

stack:up:
desc: Start the Prez stack.
cmds:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
- stack

prez:
image: ghcr.io/rdflib/prez:3.7.3
image: ghcr.io/rdflib/prez:3.8.4
ports:
- 8000:8000
environment:
Expand Down
2 changes: 1 addition & 1 deletion docker_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

INDEX_FILE=/app/assets/index.*.js;
INDEX_FILE=/app/assets/index-*.js;

grep "=" .env | while read -r line; do # loop over VITE_ env vars
left=`echo $line | awk -F "=" '{print $1}'`; # env var name
Expand Down

0 comments on commit 5299e16

Please sign in to comment.