Last active
May 20, 2016 04:21
-
-
Save migerh/0942a0ce43cd4ca4e6d1fc8629641696 to your computer and use it in GitHub Desktop.
pdftk docker container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.04 | |
MAINTAINER Michael Gerhaeuser <michael.gerhaeuser@gmail.com> | |
RUN mkdir /work | |
WORKDIR /work | |
VOLUME ["/work"] | |
RUN apt-get update | |
RUN apt-get install -y --no-install-recommends pdftk sudo | |
ENV USER_ID 1000 | |
ENV GROUP_ID 1000 | |
ADD ./entrypoint.sh /tmp/entrypoint.sh | |
ENTRYPOINT ["/tmp/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
getent group "$GROUP_ID" >/dev/null 2>&1 | |
if [ $? != 0 ]; then | |
groupadd -g $GROUP_ID somegroup >/dev/null 2>&1 | |
usermod -a -G somegroup nobody >/dev/null 2>&1 | |
fi | |
getent passwd "$USER_ID" >/dev/null 2>&1 | |
if [ $? != 0 ]; then | |
GROUP=$(getent group $GROUP_ID | cut -d: -f1) | |
useradd -u $USER_ID -g $GROUP someuser >/dev/null 2>&1 | |
fi | |
USER=$(getent passwd $USER_ID | cut -d: -f1) | |
sudo -u $USER pdftk "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
docker run -e USER_ID=`id -u` -e GROUP_ID=`id -g` -v $(pwd):/work --rm pdftk:latest "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment