@@ -6,16 +6,7 @@ ARG HTTP_PROXY=$HTTP_PROXY
6
6
ARG HTTPS_PROXY=$HTTPS_PROXY
7
7
8
8
ENV TERM=xterm-256color
9
- ENV NVM_DIR=/usr/local/nvm
10
9
ENV NODE_VERSION=10.15.1
11
- ENV NODE_PATH=$NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules
12
- ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
13
-
14
- # Create a developer folder in the home directory
15
- # TODO: actually create a user with a home folder
16
- # - need to investigate how to change UID and GID
17
- # at container creation time
18
- RUN mkdir -p /home/developer/
19
10
20
11
# Replace shell with bash so we can source files
21
12
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
@@ -43,72 +34,85 @@ RUN apt-get update && apt-get install -y -q --no-install-recommends \
43
34
postgresql postgresql-contrib \
44
35
&& rm -rf /var/lib/apt/lists/*
45
36
46
- # Install vim and customise
47
- COPY dotfiles/.vimrc /root/.vimrc
37
+ # Install docker ce so that host docker instances can be manipulated from this env
38
+ RUN apt-get update && apt-get install -y -q --no-install-recommends \
39
+ apt-transport-https \
40
+ ca-certificates \
41
+ curl \
42
+ gnupg-agent \
43
+ software-properties-common
44
+
45
+ RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
46
+ RUN add-apt-repository \
47
+ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
48
+ $(lsb_release -cs) \
49
+ stable"
50
+
51
+ RUN apt-get update && apt-get install -y -q --no-install-recommends \
52
+ docker-ce \
53
+ docker-ce-cli \
54
+ containerd.io
55
+
56
+ # Install vim 8
48
57
RUN add-apt-repository ppa:jonathonf/vim -y \
49
58
&& apt update \
50
59
&& apt install vim -y
51
60
52
- RUN rm -r /root/.vim || true \
53
- && curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
61
+ # Create developer user under which all development within the container
62
+ # will be performed
63
+ RUN useradd --create-home --shell /bin/bash developer
64
+ USER developer
65
+
66
+ # Install users vim customisations. This requires that the .vimrc
67
+ # file is copied much earlier than the other dotfiles
68
+ COPY --chown=developer:developer dotfiles/.vimrc /home/developer/.vimrc
69
+ RUN curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
54
70
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim \
55
71
&& vim +PlugInstall +qall
56
72
57
73
# Install nvm with node and npm
58
- RUN curl -o- https://raw.githubusercontent.com/creationix /nvm/v0.33.1 /install.sh | bash \
59
- && . $NVM_DIR /nvm.sh \
74
+ RUN curl -o- https://raw.githubusercontent.com/nvm-sh /nvm/v0.35.2 /install.sh | bash \
75
+ && . /home/developer/.nvm /nvm.sh \
60
76
&& nvm install $NODE_VERSION \
61
77
&& nvm alias default $NODE_VERSION \
62
78
&& nvm use default
79
+ RUN source ~/.bashrc
80
+
81
+ # Have to manually include the node folder on the path to make
82
+ # the following installs possible.
83
+ # It gets set automatically by the time we start the container,
84
+ # but for some reason it's not ready at this point.
85
+ ENV PATH="/home/developer/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
63
86
64
87
# Install npm packages
65
- RUN source /root/.bashrc
66
88
RUN npm install -g eslint \
67
89
&& npm install -g eslint-config-airbnb-base \
68
90
&& npm install -g eslint-plugin-import \
91
+ && npm install -g yo \
69
92
&& npm install -g jest \
70
93
&& npm install -g rxjs \
71
94
&& npm install -g typescript \
72
95
&& npm install -g http-server
73
96
74
97
# Copy global dotfiles
75
- COPY dotfiles/.gitconfig /root/.gitconfig
76
- COPY dotfiles/.bash_aliases /root/.bash_aliases
77
- COPY dotfiles/.eslintrc.json /root/.eslintrc.json
78
- COPY dotfiles/jest.config.js /home/developer/jest.config.js
79
- RUN source /root/.bashrc
80
-
81
- # Install docker ce so that host docker instances can be manipulated from this env
82
- RUN apt-get update && apt-get install -y -q --no-install-recommends \
83
- apt-transport-https \
84
- ca-certificates \
85
- curl \
86
- gnupg-agent \
87
- software-properties-common
88
-
89
- RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
90
- RUN add-apt-repository \
91
- "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
92
- $(lsb_release -cs) \
93
- stable"
94
-
95
- RUN apt-get update && apt-get install -y -q --no-install-recommends \
96
- docker-ce \
97
- docker-ce-cli \
98
- containerd.io
98
+ COPY --chown=developer:developer dotfiles/.gitconfig /home/developer/.gitconfig
99
+ COPY --chown=developer:developer dotfiles/.bash_aliases /home/developer/bash_aliases
100
+ COPY --chown=developer:developer dotfiles/.eslintrc.json /home/developer/eslintrc.json
101
+ COPY --chown=developer:developer dotfiles/jest.config.js /home/developer/jest.config.js
102
+ RUN source ~/.bashrc
99
103
100
104
# Copy project templates with local dotfiles
101
- COPY templates/tdd/ /home/developer/templates/tdd/
102
- COPY dotfiles/jest.config.js /home/developer/templates/tdd/.
103
- COPY dotfiles/.gitignore /home/developer/templates/tdd/.
104
- COPY dotfiles/.eslintrc.json /home/developer/templates/tdd/.
105
+ COPY --chown=developer:developer templates/tdd/ /home/developer/templates/tdd/
106
+ COPY --chown=developer:developer dotfiles/jest.config.js /home/developer/templates/tdd/.
107
+ COPY --chown=developer:developer dotfiles/.gitignore /home/developer/templates/tdd/.
108
+ COPY --chown=developer:developer dotfiles/.eslintrc.json /home/developer/templates/tdd/.
105
109
106
- COPY templates/express-app/ /home/developer/templates/express-app/
107
- COPY dotfiles/.gitignore /home/developer/templates/express-app/.
108
- COPY dotfiles/.eslintrc.json /home/developer/templates/express-app/.
110
+ COPY --chown=developer:developer templates/express-app/ /home/developer/templates/express-app/
111
+ COPY --chown=developer:developer dotfiles/.gitignore /home/developer/templates/express-app/.
112
+ COPY --chown=developer:developer dotfiles/.eslintrc.json /home/developer/templates/express-app/.
109
113
110
- COPY templates/webpack-es6/ /home/developer/templates/webpack-es6/
111
- COPY dotfiles/.gitignore /home/developer/templates/webpack-es6/.
112
- COPY dotfiles/.eslintrc.json /home/developer/templates/webpack-es6/.
114
+ COPY --chown=developer:developer templates/webpack-es6/ /home/developer/templates/webpack-es6/
115
+ COPY --chown=developer:developer dotfiles/.gitignore /home/developer/templates/webpack-es6/.
116
+ COPY --chown=developer:developer dotfiles/.eslintrc.json /home/developer/templates/webpack-es6/.
113
117
114
- LABEL version="1 .1.7 "
118
+ LABEL version="2 .1.1 "
0 commit comments