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
Some checks failed
release-tag / release-image (push) Failing after 45s
Reviewed-on: #8
This commit is contained in:
@@ -43,9 +43,25 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
|
build-args: |
|
||||||
|
CONTENT_REPO=https://git.send.nrw/b1tsblog/blogcontent.git
|
||||||
|
CONTENT_REF=main
|
||||||
platforms: |
|
platforms: |
|
||||||
linux/amd64
|
linux/amd64
|
||||||
push: true
|
push: true
|
||||||
tags: | # replace it with your local IP and tags
|
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 }}:${{ 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 }}
|
@@ -31,6 +31,7 @@ RUN mkdir -p /out/content /out/static /out/pages
|
|||||||
RUN find /src/articles -name '*.md' -exec cp {} /out/content/ \;
|
RUN find /src/articles -name '*.md' -exec cp {} /out/content/ \;
|
||||||
RUN cp -r /src/static/* /out/static/
|
RUN cp -r /src/static/* /out/static/
|
||||||
RUN cp -r /src/pages/* /out/pages/
|
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/content /content
|
||||||
COPY --from=content /out/static /static
|
COPY --from=content /out/static /static
|
||||||
COPY --from=content /out/pages /pages
|
COPY --from=content /out/pages /pages
|
||||||
|
COPY --from=content /out/templates /templates
|
||||||
|
|
||||||
ENV BLOG_CONTENT_DIR=/content
|
ENV BLOG_CONTENT_DIR=/content
|
||||||
ENV BLOG_STATIC_DIR=/static
|
ENV BLOG_STATIC_DIR=/static
|
||||||
ENV BLOG_PAGES_DIR=/pages
|
ENV BLOG_PAGES_DIR=/pages
|
||||||
|
ENV BLOG_TEMPLATES_DIR=/templates
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
CMD ["blog"]
|
CMD ["blog"]
|
||||||
|
@@ -57,6 +57,11 @@ func main() {
|
|||||||
staticDir = "/pages"
|
staticDir = "/pages"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
templatesDir := os.Getenv("BLOG_TEMPLATES_DIR")
|
||||||
|
if templatesDir == "" {
|
||||||
|
templatesDir = "/templates"
|
||||||
|
}
|
||||||
|
|
||||||
funcs := template.FuncMap{
|
funcs := template.FuncMap{
|
||||||
"now": time.Now, // jetzt‑Zeit bereitstellen
|
"now": time.Now, // jetzt‑Zeit bereitstellen
|
||||||
}
|
}
|
||||||
@@ -64,19 +69,19 @@ func main() {
|
|||||||
// Basislayout zuerst parsen
|
// Basislayout zuerst parsen
|
||||||
layout := template.Must(
|
layout := template.Must(
|
||||||
template.New("base").Funcs(funcs).
|
template.New("base").Funcs(funcs).
|
||||||
ParseFiles("/app/internal/web/templates/base.html"),
|
ParseFiles(templatesDir + "/base.html"),
|
||||||
)
|
)
|
||||||
|
|
||||||
// LIST‑Seite: base + list.html
|
// LIST‑Seite: base + list.html
|
||||||
tplList = template.Must(layout.Clone())
|
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"))
|
||||||
|
|
||||||
// ARTICLE‑Instanz
|
// ARTICLE‑Instanz
|
||||||
tplArticle = template.Must(layout.Clone())
|
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())
|
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()
|
mux := http.NewServeMux()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user