Skip to content

Commit

Permalink
Merge pull request #5 from Hydroxycarbamide/restore-peaceiris-versioning
Browse files Browse the repository at this point in the history
Dockerfile: Restore peaceiris versioning using Makefile
  • Loading branch information
hydroxycarbamide authored May 1, 2024
2 parents 56d8a3f + d15081a commit 6ec9572
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
- name: Set env
run: |
MDBOOK_VERSION="$(make get-mdbook-version)"
MDBOOK_CATPPUCCIN_VERSION="$(make get-mdbook-catppuccin-version)"
TAG_NAME="v${MDBOOK_VERSION}"
TAG_NAME_LATEST="latest"
if [ "${{ startsWith( matrix.baseimage, 'rust:') }}" = "true" ]; then
Expand All @@ -53,6 +54,7 @@ jobs:
{
echo "TAG_NAME=${TAG_NAME}"
echo "MDBOOK_VERSION=${MDBOOK_VERSION}"
echo "MDBOOK_CATPPUCCIN_VERSION=${MDBOOK_CATPPUCCIN_VERSION}"
echo "PKG_TAG=${DOCKER_BASE_NAME}:${TAG_NAME}"
echo "PKG_TAG_LATEST=${DOCKER_BASE_NAME}:${TAG_NAME_LATEST}"
} >> "${GITHUB_ENV}"
Expand All @@ -76,6 +78,7 @@ jobs:
docker buildx build . \
--tag "${PKG_TAG}" \
--build-arg MDBOOK_VERSION="${MDBOOK_VERSION}" \
--build-arg MDBOOK_CATPPUCCIN_VERSION="${MDBOOK_CATPPUCCIN_VERSION}" \
--build-arg BASE_IMAGE="${{ matrix.baseimage }}" \
--cache-from "type=gha,scope=${DOCKER_SCOPE}" \
--cache-to "type=gha,mode=max,scope=${DOCKER_SCOPE}" \
Expand All @@ -87,6 +90,7 @@ jobs:
docker buildx build . \
--tag "${PKG_TAG}" \
--build-arg MDBOOK_VERSION="${MDBOOK_VERSION}" \
--build-arg MDBOOK_CATPPUCCIN_VERSION="${MDBOOK_CATPPUCCIN_VERSION}" \
--build-arg BASE_IMAGE="${{ matrix.baseimage }}" \
--output 'type=docker'
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ FROM rust:alpine AS builder
RUN apk add --no-cache musl-dev
ENV ARC="x86_64-unknown-linux-musl"
RUN rustup target add "${ARC}"
RUN cargo install mdbook --target "${ARC}"
RUN cargo install mdbook-catppuccin --target "${ARC}"
ARG MDBOOK_VERSION
RUN cargo install mdbook --version "${MDBOOK_VERSION}" --target "${ARC}"
ARG MDBOOK_CATPPUCCIN_VERSION
RUN cargo install mdbook-catppuccin --version "${MDBOOK_CATPPUCCIN_VERSION}" --target "${ARC}"

FROM $BASE_IMAGE

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.PHOPY: get-mdbook-version
get-mdbook-version:
@cat ./deps/Cargo.toml | grep 'mdbook = ' | awk '{print $$3}' | tr -d '"'


get-mdbook-catppuccin-version:
@cat ./deps/Cargo.toml | grep 'mdbook-catppuccin = ' | awk '{print $$3}' | tr -d '"'

0 comments on commit 6ec9572

Please sign in to comment.