Skip to content

Commit

Permalink
Merge pull request #37 from WORD-COINS/fix-docker-imge
Browse files Browse the repository at this point in the history
色々修正した
  • Loading branch information
puripuri2100 authored Nov 12, 2024
2 parents c78ad73 + 489e913 commit dc15c43
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 50 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,25 @@ name: CI
jobs:
build-image:
name: Build and push image
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux/amd64
- os: macos-latest
platform: linux/arm64
runs-on: ${{ matrix.os }}
steps:
- name: Install Docker and start Colima on macOS
if: matrix.os == 'macos-latest'
run: |
brew install docker
brew install colima
LIMACTL_PATH=$(brew --prefix)/bin/limactl
sudo curl -L -o $LIMACTL_PATH https://github.com/mikekazakov/lima-nohvf/raw/master/limactl && sudo chmod +x $LIMACTL_PATH
colima start --network-address --arch arm64 --vm-type=qemu
- uses: actions/checkout@v4

- name: Docker meta
Expand All @@ -29,6 +46,11 @@ jobs:
- name: Set up Buildx
uses: docker/setup-buildx-action@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.platform }}

- name: Login to ghcr.io
uses: docker/login-action@v3
with:
Expand All @@ -41,6 +63,7 @@ jobs:
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
Expand Down
100 changes: 51 additions & 49 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,63 +1,66 @@
FROM debian:stable-20220316-slim
FROM ubuntu:noble AS base
ARG TARGETARCH

FROM base AS build-arm64
ENV AWS_CLI_ARCH=linux-aarch64
ENV TEX_LIVE_ARCH=aarch64-linux

FROM base AS build-amd64
ENV AWS_CLI_ARCH=linux-x86_64
ENV TEX_LIVE_ARCH=x86_64-linux

FROM build-${TARGETARCH}

# WORD内部向けコンテナなので、何か問題が有ったらSlack上で通知して下さい。
MAINTAINER Totsugekitai <[email protected]>

ENV PERSISTENT_DEPS \
tar \
fontconfig \
unzip \
wget \
curl \
make \
perl \
ghostscript \
bash \
git \
groff \
less \
fonts-ebgaramond
LABEL maintainer="Totsugekitai <[email protected]>"

ENV PERSISTENT_DEPS="tar fontconfig unzip wget curl make perl ghostscript bash git groff less fonts-ebgaramond"

# キャッシュ修正とパッケージインストールは同時にやる必要がある
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
tzdata $PERSISTENT_DEPS

# install awscliv2
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
RUN curl "https://awscli.amazonaws.com/awscli-exe-$AWS_CLI_ARCH.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -r ./aws awscliv2.zip

ENV FONT_URLS \
https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip \
https://github.com/adobe-fonts/source-han-sans/releases/latest/download/SourceHanSansJP.zip \
https://github.com/adobe-fonts/source-han-serif/raw/release/SubsetOTF/SourceHanSerifJP.zip
ENV FONT_PATH /usr/share/fonts/
ENV FONT_URLS="https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip \
https://github.com/adobe-fonts/source-han-sans/releases/latest/download/SourceHanSansJP.zip \
https://github.com/adobe-fonts/source-han-serif/raw/release/SubsetOTF/SourceHanSerifJP.zip"
ENV FONT_PATH="/usr/share/fonts/"
RUN mkdir -p $FONT_PATH && \
wget $FONT_URLS && \
unzip -j "*.zip" "*.otf" -d $FONT_PATH && \
rm *.zip && \
fc-cache -f -v
wget $FONT_URLS && \
unzip -j "*.zip" "*.otf" -d $FONT_PATH && \
rm *.zip && \
fc-cache -f -v

RUN cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime && \
echo 'Asia/Tokyo' > /etc/timezone

# Install TeXLive
ENV TEXLIVE_PATH /usr/local/texlive
RUN mkdir -p /tmp/install-tl-unx && \
wget -qO- http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz | \
tar -xz -C /tmp/install-tl-unx --strip-components=1 && \
printf "%s\n" \
"TEXDIR $TEXLIVE_PATH" \
"selected_scheme scheme-small" \
"option_doc 0" \
"option_src 0" \
"option_autobackup 0" \
> /tmp/install-tl-unx/texlive.profile && \
/tmp/install-tl-unx/install-tl \
-profile /tmp/install-tl-unx/texlive.profile

ENV PATH $TEXLIVE_PATH/bin/x86_64-linux:$TEXLIVE_PATH/bin/aarch64-linux:$PATH
# ENV TEXLIVE_PATH /usr/local/texlive
# RUN mkdir -p /tmp/install-tl-unx && \
# wget -qO- http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz | \
# tar -xz -C /tmp/install-tl-unx --strip-components=1 && \
# printf "%s\n" \
# "TEXDIR $TEXLIVE_PATH" \
# "selected_scheme scheme-small" \
# "option_doc 0" \
# "option_src 0" \
# "option_autobackup 0" \
# > /tmp/install-tl-unx/texlive.profile && \
# /tmp/install-tl-unx/install-tl \
# -profile /tmp/install-tl-unx/texlive.profile

# ENV PATH $TEXLIVE_PATH/bin/x86_64-linux:$TEXLIVE_PATH/bin/aarch64-linux:$PATH

COPY --from=registry.gitlab.com/islandoftex/images/texlive:latest-small /usr/local/texlive /usr/local/texlive

RUN echo "Set PATH to $PATH" && \
$(find /usr/local/texlive -name tlmgr) path add

# tlmgr section
RUN tlmgr update --self
Expand All @@ -69,19 +72,18 @@ RUN tlmgr install --no-persistent-downloads \
fontaxes boondox everyhook svn-prov framed subfiles titlesec \
tocdata xpatch etoolbox l3packages \
biblatex pbibtex-base logreq biber import environ trimspaces tcolorbox \
ebgaramond algorithms algorithmicx xstring siunitx bussproofs enumitem
ebgaramond algorithms algorithmicx xstring siunitx bussproofs enumitem && \
tlmgr path add

# EBGaramond
RUN cp /usr/share/fonts/opentype/ebgaramond/EBGaramond12-Regular.otf /usr/share/fonts/opentype/EBGaramond.otf && \
RUN cp /usr/share/fonts/opentype/ebgaramond/EBGaramond12-Regular.otf "/usr/share/fonts/opentype/EB Garamond.otf" && \
fc-cache -frvv && \
luaotfload-tool --update

ARG TARGETARCH

# Install Pandoc
ENV PANDOC_VERSION 3.2.1
ENV PANDOC_DOWNLOAD_URL https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$PANDOC_VERSION-linux-$TARGETARCH.tar.gz
ENV PANDOC_ROOT /usr/local/bin/pandoc
ENV PANDOC_VERSION="3.5"
ENV PANDOC_DOWNLOAD_URL="https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$PANDOC_VERSION-linux-$TARGETARCH.tar.gz"
ENV PANDOC_ROOT="/usr/local/bin/pandoc"
RUN wget -qO- "$PANDOC_DOWNLOAD_URL" | tar -xzf - && \
cp pandoc-$PANDOC_VERSION/bin/pandoc $PANDOC_ROOT && \
rm -Rf pandoc-$PANDOC_VERSION/
Expand Down

0 comments on commit dc15c43

Please sign in to comment.