Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile: Restore peaceiris versioning using Makefile #5

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 '"'