Skip to content

Instantly share code, notes, and snippets.

@u1f992
Created May 8, 2025 15:01
Show Gist options
  • Select an option

  • Save u1f992/1cbc82280d5c4e58c164c96d2ccf5391 to your computer and use it in GitHub Desktop.

Select an option

Save u1f992/1cbc82280d5c4e58c164c96d2ccf5391 to your computer and use it in GitHub Desktop.
# autotrace.dockerfile
# Copyright (C) 2025 Koutaro Mukai
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# ```
# $ docker build --file autotrace.dockerfile --tag autotrace:0.31.10 .
# $ docker run --interactive --mount type=bind,source=$(pwd),target=/workdir --rm --tty --workdir /workdir autotrace:0.31.10 --version
#
# $ echo "alias autotrace='docker run --interactive --mount type=bind,source=\$(pwd),target=/workdir --rm --tty --workdir /workdir autotrace:0.31.10'" >> ~/.bashrc
# $ source ~/.bashrc
# ```
FROM ubuntu:24.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /opt
RUN apt-get update && apt-get --yes --no-install-recommends install \
ca-certificates \
git \
&& rm -rf /var/lib/apt/lists/* \
&& git clone --depth 1 --branch 0.31.10 https://github.com/autotrace/autotrace.git
# Cannot upgrade Ubuntu.
# It seems to be a destructive change in libpstoedit-dev since 22.04.
#
# - https://sourceforge.net/p/pstoedit/bugs/33/
# - https://sourceforge.net/p/pstoedit/patches/5/
#
# ```
# In file included from src/output-pstoedit.c:29:
# /usr/include/pstoedit/pstoedit.h:104:48: error: unknown type name 'std'; did you mean 'stdin'?
# 104 | void loadpstoeditplugins(const char* progname, std::ostream & errstream, bool verbose);
# | ^~~
# | stdin
# /usr/include/pstoedit/pstoedit.h:104:74: error: unknown type name 'bool'
# 104 | void loadpstoeditplugins(const char* progname, std::ostream & errstream, bool verbose);
# | ^~~~
# ```
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
COPY --from=builder /opt/autotrace /autotrace
RUN cd /autotrace \
# https://github.com/autotrace/autotrace/issues/21
&& apt-get update && apt-get --yes --no-install-recommends install \
autopoint \
autotools-dev \
# binutils-mingw-w64 \
# binutils-mingw-w64-x86-64 \
checkinstall \
diffutils \
fakeroot \
intltool \
libbz2-dev \
libexif-dev \
libfreetype6-dev \
libjpeg-dev \
libmagickcore-dev \
libpng-dev \
libpstoedit-dev \
libtiff5-dev \
libtool \
libxml2-dev \
# mingw-w64 \
# mingw-w64-tools \
nsis \
# /usr/bin/ld: cannot find -lstdc++: No such file or directory
g++ \
&& rm -rf /var/lib/apt/lists/* \
&& autoreconf -ivf \
&& intltoolize --force \
&& sh ./configure --prefix=/usr \
&& aclocal \
&& make -j"$(nproc)" \
&& make install
ENTRYPOINT ["autotrace"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment