-
Notifications
You must be signed in to change notification settings - Fork 21
/
headless_ubuntu_zcli.Dockerfile
48 lines (35 loc) · 1.57 KB
/
headless_ubuntu_zcli.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
43
44
45
46
47
48
# Use Ubuntu 22.04 LTS as base image
FROM ubuntu:22.04
# Install dependencies required for adding repositories
RUN apt-get update && apt-get install -y curl gnupg2 ca-certificates lsb-release
# Install required dependencies
RUN apt-get update && apt-get install -y npm dbus-x11 libsecret-1-dev gnome-keyring
# Make sure ca-certificates is installed
RUN apt-get install -y ca-certificates
# Install nvm, Node.js
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 18
# Use bash shell for the install script
SHELL ["/bin/bash", "-c"]
# Install nvm (Note: the version might need updating)
RUN mkdir -p $NVM_DIR && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
# Install Node.js 18 and set it as the default
RUN source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
# Add nvm.sh to .bashrc for future login shells
RUN echo 'export NVM_DIR="$NVM_DIR"' >> /etc/bash.bashrc \
&& echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> /etc/bash.bashrc
# Add node and npm to path so the commands are available
ENV NODE_PATH $NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
RUN npm install @zendesk/zcli -g
# For headless Linux:
RUN echo 'export $(dbus-launch)' >> /etc/bash.bashrc
# Init kerying storage by creating a default file
RUN echo 'echo "123456" | gnome-keyring-daemon -r --unlock --components=secrets' >> /etc/bash.bashrc
# # Set the work directory
WORKDIR /app
# Command to run when starting the container
CMD [ "bash" ]