From 7cb723f2f525d124e9d1ca4c1ce878ec08f6fda7 Mon Sep 17 00:00:00 2001 From: Adam Kudrna Date: Tue, 6 Dec 2016 12:39:22 +0100 Subject: [PATCH] Prepare Docker container for automated builds --- docker-compose.yml | 4 ++++ docker/Node/Dockerfile | 12 ++++++++++++ docker/Node/init-container.sh | 11 +++++++++++ 3 files changed, 27 insertions(+) create mode 100644 docker-compose.yml create mode 100644 docker/Node/Dockerfile create mode 100644 docker/Node/init-container.sh diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c5e7196 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,4 @@ +node: + build: docker/Node + volumes: + - .:/workspace diff --git a/docker/Node/Dockerfile b/docker/Node/Dockerfile new file mode 100644 index 0000000..79c04ca --- /dev/null +++ b/docker/Node/Dockerfile @@ -0,0 +1,12 @@ +FROM fedora:latest + +RUN curl --silent --location https://rpm.nodesource.com/setup_7.x | bash - +RUN dnf install -y git nodejs +RUN mkdir /home/docker-container-user +RUN mkdir /workspace +RUN useradd -d /home/docker-container-user -s /bin/bash docker-container-user +RUN npm install --global grunt-cli +RUN npm install --global bower + +COPY ./init-container.sh /root/init-container.sh +WORKDIR /workspace diff --git a/docker/Node/init-container.sh b/docker/Node/init-container.sh new file mode 100644 index 0000000..1dfe3a1 --- /dev/null +++ b/docker/Node/init-container.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + +# This script is to be executed when the docker container is started + +# Set UID of user docker-container-user on guest to match the UID of the user on the host machine +usermod -u $(stat -c "%u" $1) docker-container-user +# Set GID of group docker-container-user on guest to match the GID of the users primary group on the host machine +groupmod -g $(stat -c "%g" $1) docker-container-user + +chown -R docker-container-user /home/docker-container-user +chown -R docker-container-user /workspace