Merge pull request 'Anpassung für dynamische Content-Gits' (#8) from staging into main
Some checks failed
release-tag / release-image (push) Failing after 45s

Reviewed-on: #8
This commit is contained in:
2025-05-10 17:14:28 +00:00
3 changed files with 29 additions and 5 deletions

View File

@@ -43,9 +43,25 @@ jobs:
with:
context: .
file: ./Dockerfile
build-args: |
CONTENT_REPO=https://git.send.nrw/b1tsblog/blogcontent.git
CONTENT_REF=main
platforms: |
linux/amd64
push: true
tags: | # replace it with your local IP and tags
${{ vars.DOCKER_REGISTRY }}/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
${{ vars.DOCKER_REGISTRY }}/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
${{ vars.DOCKER_REGISTRY }}/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
- name: Build and push StarCitizen
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
build-args: |
CONTENT_REPO=https://git.send.nrw/b1tsblog/sccontent.git
CONTENT_REF=main
platforms: |
linux/amd64
push: true
tags: | # replace it with your local IP and tags
${{ vars.DOCKER_REGISTRY }}/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:sc-${{ env.DOCKER_LATEST }}

View File

@@ -31,6 +31,7 @@ RUN mkdir -p /out/content /out/static /out/pages
RUN find /src/articles -name '*.md' -exec cp {} /out/content/ \;
RUN cp -r /src/static/* /out/static/
RUN cp -r /src/pages/* /out/pages/
RUN cp -r /src/templates/* /out/templates/
############################
@@ -52,10 +53,12 @@ COPY . /app
COPY --from=content /out/content /content
COPY --from=content /out/static /static
COPY --from=content /out/pages /pages
COPY --from=content /out/templates /templates
ENV BLOG_CONTENT_DIR=/content
ENV BLOG_STATIC_DIR=/static
ENV BLOG_PAGES_DIR=/pages
ENV BLOG_TEMPLATES_DIR=/templates
EXPOSE 8080
CMD ["blog"]

View File

@@ -57,6 +57,11 @@ func main() {
staticDir = "/pages"
}
templatesDir := os.Getenv("BLOG_TEMPLATES_DIR")
if templatesDir == "" {
templatesDir = "/templates"
}
funcs := template.FuncMap{
"now": time.Now, // jetztZeit bereitstellen
}
@@ -64,19 +69,19 @@ func main() {
// Basislayout zuerst parsen
layout := template.Must(
template.New("base").Funcs(funcs).
ParseFiles("/app/internal/web/templates/base.html"),
ParseFiles(templatesDir + "/base.html"),
)
// LISTSeite: base + list.html
tplList = template.Must(layout.Clone())
template.Must(tplList.Funcs(funcs).ParseFiles("/app/internal/web/templates/list.html"))
template.Must(tplList.Funcs(funcs).ParseFiles(templatesDir + "/list.html"))
// ARTICLEInstanz
tplArticle = template.Must(layout.Clone())
template.Must(tplArticle.Funcs(funcs).ParseFiles("/app/internal/web/templates/article.html"))
template.Must(tplArticle.Funcs(funcs).ParseFiles(templatesDir + "/article.html"))
tplPage := template.Must(layout.Clone())
template.Must(tplPage.ParseFiles("/app/internal/web/templates/page.html"))
template.Must(tplPage.ParseFiles(templatesDir + "/page.html"))
mux := http.NewServeMux()