Created
October 27, 2018 20:28
-
-
Save lpenz/09776db42cf5bdb5d6a2553d53f8899e to your computer and use it in GitHub Desktop.
Dockerfile that creates a container that installs fluorite + electron locally
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
# You can use this Dockerfile to avoid having to install npm to | |
# get fluorine + electron installed locally. | |
# You still need node.js to run it, however. | |
# To use: | |
# docker build -t fluorine . | |
# docker run -it --rm -v $PWD:/home/user/work -e MY_UID=$UID fluorine | |
# The container will exit after fluorine + electron are set up; you can then | |
# remove the container with: | |
# docker rmi fluorine | |
# To run fluorine: | |
# ./node_modules/.bin/electron | |
FROM debian:buster | |
RUN set -e -x; \ | |
apt-get update; \ | |
apt-get install -y --no-install-recommends \ | |
gosu sudo \ | |
npm | |
# create installation script: | |
RUN set -x -e; \ | |
(\ | |
echo '#!/bin/bash'; \ | |
echo 'set -x -e'; \ | |
echo 'npm install --save-dev electron'; \ | |
echo 'npm install'; \ | |
) > /usr/local/bin/fluorine-install.sh; \ | |
chmod a+x /usr/local/bin/fluorine-install.sh | |
# run installation script with correct UID/GID | |
RUN set -x -e; \ | |
(\ | |
echo '#!/bin/bash'; \ | |
echo 'MY_UID=${MY_UID:-1000}'; \ | |
echo 'set -x -e'; \ | |
echo 'useradd -M -u "$MY_UID" -o user'; \ | |
echo 'chown -R user:user /home/user'; \ | |
echo 'cd /home/user/work'; \ | |
echo 'exec gosu user "${@:-/usr/local/bin/fluorine-install.sh}"'; \ | |
) > /usr/local/bin/entrypoint.sh; \ | |
chmod a+x /usr/local/bin/entrypoint.sh | |
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment