Skip to content

Commit

Permalink
Create 'miktex' user in entrypoint.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
edocevoli committed Feb 3, 2019
1 parent 4badf62 commit 47f0980
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
36 changes: 23 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
FROM ubuntu:xenial
FROM ubuntu:bionic

LABEL Description="Dockerized MiKTeX, Ubuntu 16.04" Vendor="Christian Schenk" Version="2.9.6628"

RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D6BC243565B2087BC3F897C9277A7293F59E4889
RUN echo "deb http://miktex.org/download/ubuntu xenial universe" | tee /etc/apt/sources.list.d/miktex.list
LABEL Description="Dockerized MiKTeX, Ubuntu 18.04" Vendor="Christian Schenk" Version="2.9.6970"

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates
ca-certificates \
dirmngr \
ghostscript \
gnupg \
gosu \
make \
perl

RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D6BC243565B2087BC3F897C9277A7293F59E4889
RUN echo "deb http://miktex.org/download/ubuntu bionic universe" | tee /etc/apt/sources.list.d/miktex.list

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
miktex \
perl
miktex

RUN useradd -md /miktex miktex
USER miktex
RUN miktexsetup finish \
&& initexmf --admin --set-config-value=[MPM]AutoInstall=1 \
&& mpm --admin --update-db \
&& mpm --admin \
--install amsfonts \
--install biber-linux-x86_64

RUN miktexsetup finish
RUN initexmf --set-config-value=[MPM]AutoInstall=1
RUN mpm --install amsfonts
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]

WORKDIR /miktex/work

CMD ["bash"]
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ configured to install missing files in the container directory
`/miktex/.miktex`. It is recommended that you mount this directory to
a Docker volume.

You should specify a user by setting the container environment
variables `MIKTEX_GID` and `MIKTEX_UID`.

### Example

First, create a Docker volume named `miktex`:
Expand All @@ -39,5 +42,7 @@ directory, you can run `pdflatex` as follows:
docker run -ti \
-v miktex:/miktex/.miktex \
-v `pwd`:/miktex/work \
-e MIKTEX_GID=`id -g` \
-e MIKTEX_UID=`id -u` \
miktex/miktex \
pdflatex main.tex
12 changes: 12 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

MIKTEX_GID=${MIKTEX_GID:-1001}
MIKTEX_UID=${MIKTEX_UID:-1001}

groupadd -g $MIKTEX_GID -o miktex
useradd --shell /bin/bash -u $MIKTEX_UID -g $MIKTEX_GID -o -c "" -Md /miktex miktex

chown miktex:miktex /miktex
chown miktex:miktex /miktex/work

exec gosu miktex "$@"

0 comments on commit 47f0980

Please sign in to comment.