forked from tucker01/jenkins-nvm-keytar
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
42 lines (29 loc) · 1.31 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# This Dockerfile is used to build an image capable of running the npm keytar node module
# It must be given the capability of IPC_LOCK or be run in privilaged mode to properly operate
FROM ahumanfromca/jenkins-npm-agent
USER root
# Installs the libsecret library required by keytar
RUN apt-get update && apt-get install -y gnome-keyring libsecret-1-dev
ARG tempDir=/tmp/jenkins-npm-keytar
ARG sshEnv=/etc/profile.d/dbus_start.sh
ARG bashEnv=/etc/bash.bashrc
ARG loginFile=pam.d.config
RUN mkdir ${tempDir}
# Copy the PAM configuration options to allow auto unlocking of the gnome keyring
COPY ${loginFile} ${tempDir}/${loginFile}
# Enable unlocking for ssh
RUN cat ${tempDir}/${loginFile}>>/etc/pam.d/sshd
# Enable unlocking for regular login
RUN cat ${tempDir}/${loginFile}>>/etc/pam.d/login
# Copy the profile script
COPY dbus_start ${tempDir}/dbus_start
# Enable dbus for ssh and most other native shells (interactive)
RUN touch ${sshEnv} \
&& echo '#!/bin/sh'>>${sshEnv} \
&& cat ${tempDir}/dbus_start>>${sshEnv}
# Enable for all bash profiles
# Add the dbus launch before exiting when not running interactively
RUN sed -i -e "/# If not running interactively, don't do anything/r ${tempDir}/dbus_start" -e //N ${bashEnv}
# Cleanup any temp files we have created
RUN rm -rdf ${tempDir}
CMD ["/usr/sbin/sshd", "-D"]