[JAVA] Create a Docker container to convert EPS to PGF source

Last year, Mr. Kano of Lambda Note announced TeXConf 2018 and TeX & LaTeX Advent Calendar 2018. EPS in a modern TeX environment in Day 4 article of //adventar.org/calendars/3382) He mentioned how to use the file.

In this article, a tool called ** eps2pgf ** was introduced.

Some people think the same thing, and some people have already made a Java conversion tool called ** eps2pgf ** (Reference. )). Currently, although it is posted on SourceForge, it seems that it is not maintained without the source, but for the time being, I downloaded it and used it, and I got some satisfactory results.

This tool called eps2pgf is a Java tool more than 10 years ago (it was August 2008 when you look at the update date), but now it is Status. : Abandoned, and development seems to have stopped for a long time. Although it is an Apache license, the source is missing.

However, it is still a very useful tool (I am happy to be able to convert EPS to PGF source Mr. Kano's article / 183000)). However, installing the JVM just for this is a hassle, so I created a Docker container that packs the JVM and this tool.

Which Java Docker Image to Choose?

Docker Hub has a lot of Java (JRE, JDK) images, even the official ones, and I'm wondering which one to choose. In the next article, each feature and selection criteria were summarized in an easy-to-understand manner.

This time,

so,

I chose ʻopenjdk: 8-jre-alpine`.

How to use

The completed image has been uploaded to Docker Hub as doratex / eps2pgf, so

$ docker pull doratex/eps2pgf

Then you can pull.

Since / workdir is the working directory in the container, it is assumed that it will be bound-mounted with the current directory.

alias eps2pgf="docker run --rm \
  --mount type=bind,src=\"\$(pwd)\",dst=/workdir \
  doratex/eps2pgf"

It will be easier if you set an alias such as. Since the wrapper script of ʻeps2pgf.jar is specified as ʻENTRYPOINT of the Docker image, under this alias is set.

$ eps2pgf tiger.eps -o tiger.pgf

You can convert EPS plates to PGF sources, for example.

manual

The original ʻeps2pgf.jardocumentation is available from the SourceForge Repository Archive (https://sourceforge.net/projects/eps2pgf/). It is also recorded in/ eps2pgf / doc /` in the Docker container, so

$ docker run --rm \
  --mount type=bind,src="$(pwd)",dst=/workdir \
  --entrypoint /bin/cp \
  doratex/eps2pgf \
  -p /eps2pgf/doc/eps2pgf_manual.pdf .

You can also retrieve it to the current directory as such.

Dockerfile

The Dockerfile prepared to create this image is as follows.

Dockerfile


FROM openjdk:8-jre-alpine

LABEL maintainer="doraTeX <taylorkgb [at] gmail.com>"

WORKDIR /workdir

RUN apk upgrade --update && \
    mkdir /eps2pgf && \
    cd /eps2pgf && \
    wget -q https://excellmedia.dl.sourceforge.net/project/eps2pgf/Eps2pgf/Eps2pgf%200.7.0/eps2pgf-0.7.0.zip && \
    unzip eps2pgf-0.7.0.zip && \
    rm eps2pgf-0.7.0.zip && \
    cd /usr/local/bin && \
    printf "%s\n" \
      "#!/bin/sh" \
      "java -jar /eps2pgf/eps2pgf.jar \"\$@\"" \
      > eps2pgf && \
    chmod +x eps2pgf

ENTRYPOINT ["eps2pgf"]

Recommended Posts

Create a Docker container to convert EPS to PGF source
How to get a heapdump from a Docker container
I made a Docker container to run Maven
How to create a method
How to create a lightweight container image for Java apps
I tried to create a padrino development environment with Docker
Create a Vue3 environment with Docker!
Introduction to Linux Container / Docker (Part 1)
Create a lightweight STNS Docker image
How to make a Java container
Run React on a Docker container
A little happy that Nginx's Docker container defaults to graceful shutdown
[Java] How to create a folder
Introduction to Linux Container / Docker (Part 2)
Run PureScript on a Docker container
Let's create a Docker container that can connect to CentOS 8 with the minimum configuration by SSH
Try to create a server-client app
Use Jenkins to build inside Docker and then create a Docker image.
Pass environment variables to docker container
[Docker] Operation up to container creation # 2
How to quickly create a reverse proxy that supports HTTPS with Docker
[Docker] How to create a virtual environment for Rails and Nuxt.js apps
Create a program to post to Slack with GO and make it a container
[Docker] How to build when the source code is bind-mounted on the container
How to start a Docker container with a volume mounted in a batch file
Create a web environment quickly using Docker
Docker push to GitHub Container Registry (ghcr.io)
Run Embulk on Docker to convert files
How to create a Maven repository for 2020
Create a MySQL environment with Docker from 0-> 1
Create Docker to use Edge TPU compiler
[Docker] Copy files from docker container to host
Docker container build fails to install php-radis
Introduction to Docker / Kubernetes Practical Container Development
[Swift5] How to create a splash screen
[rails] How to create a partial template
Docker Compact Manual (4: Create a custom image)
Error response from daemon: conflict: Conflict when trying to create Docker container, so solution
I tried to create a portfolio with AWS, Docker, CircleCI, Laravel [with reference link]
How to create a small docker image of openjdk 11 (ea) application (1GB → 85MB)
[First environment construction] I tried to create a Rails 6 + MySQL 8.0 + Docker environment on Windows 10.
Up to the point of launching a Docker container built using RedHat Quarkus
Build a development environment to create Ruby on Jets + React apps with Docker
[Introduction to Docker] Create a Docker image for machine learning and use Jupyter notebook
How to create a database for H2 Database anywhere
[Memo] Create a CentOS 8 environment easily with Docker
How to check the logs in the Docker container
How to deploy a container on AWS Lambda
[Android] Inherit ImageView to create a new class
[Rails] rails new to create a database with PostgreSQL
[Rails] How to create a graph using lazy_high_charts
[Android] How to convert a character string to resourceId
Create a Lambda Container Image based on Java 15
Convert a string to a character-by-character array with swift
Setting to exit from Docker container with VScode
Copy files from docker container to host (docker cp)
How to create a class that inherits class information
How to convert a solidity contract to a Java contract class
I tried to create a LINE clone app
How to update pre-built files in docker container
How to create a theme in Liferay 7 / DXP