Skip to content

Commit

Permalink
feat: Remove build dir after install
Browse files Browse the repository at this point in the history
  • Loading branch information
cdalvaro committed Apr 7, 2024
1 parent 1fa1878 commit 11e22e7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ ENV IMAGE_VERSION="${NERDFONTS_VERSION}"

ENV BUILD_DIR="/build" \
WORKDIR="/nerd-fonts"
ENV REPOSITORY_DIR="${WORKDIR}/repo"
RUN mkdir -p "${REPOSITORY_DIR}"

ENV FONTPATCHER_DIR="${WORKDIR}/repo"
RUN mkdir -p "${FONTPATCHER_DIR}"

# Install nerd fonts
COPY assets/build/ ${BUILD_DIR}
WORKDIR ${BUILD_DIR}
RUN bash ${BUILD_DIR}/install.sh
RUN bash ${BUILD_DIR}/install.sh && rm -rf ${BUILD_DIR}

LABEL org.opencontainers.image.title="Dockerized Nerd Fonts Patcher"
LABEL org.opencontainers.image.description="Nerd Fonts ${NERDFONTS_VERSION} containerized"
Expand Down
2 changes: 1 addition & 1 deletion assets/build/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ NERDFONTS_URL="https://github.com/ryanoasis/nerd-fonts/archive/refs/tags/${NERDF
NERDFONTS_FILE_NAME="nerd-fonts.tar.gz"
download "${NERDFONTS_URL}" "${NERDFONTS_FILE_NAME}" --progress=bar --show-progress
check_sha256 "${NERDFONTS_FILE_NAME}" "${NERDFONTS_SHA256}"
extract "${NERDFONTS_FILE_NAME}" "${REPOSITORY_DIR}" --exclude='patched-fonts'
extract "${NERDFONTS_FILE_NAME}" "${FONTPATCHER_DIR}" --exclude='patched-fonts'

# Purge build dependencies and cleanup apt
apt-get purge -y --auto-remove "${BUILD_DEPENDENCIES[@]}"
Expand Down
6 changes: 3 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ function log_error() {
(>&2 echo -e "${RED}Error${RESET}: $*")
}

if [[ -z "${REPOSITORY_DIR}" ]]; then
log_error "REPOSITORY_DIR environment variable should be set but it is not. Please report this issue at: https://github.com/cdalvaro/docker-nerd-fonts-patcher/issues"
if [[ -z "${FONTPATCHER_DIR}" ]]; then
log_error "FONTPATCHER_DIR environment variable should be set but it is not. Please report this issue at: https://github.com/cdalvaro/docker-nerd-fonts-patcher/issues"
exit 1
fi

Expand Down Expand Up @@ -67,7 +67,7 @@ fi
# Patch fonts
for font in "${fonts[@]}"; do
log_info "Patching font ${CYAN}${font}${RESET} ..."
fontforge -script "${REPOSITORY_DIR}"/font-patcher -out "${OUTPUT_DIR}/" "${options[@]}" "${font}"
fontforge -script "${FONTPATCHER_DIR}"/font-patcher -out "${OUTPUT_DIR}/" "${options[@]}" "${font}"
done

# Save log file
Expand Down

0 comments on commit 11e22e7

Please sign in to comment.