-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile_dev
83 lines (62 loc) · 2.34 KB
/
Dockerfile_dev
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Fetch used node image
FROM node:23.5.0-slim
# Let's use bash as a default shell with login each time
SHELL ["/bin/bash", "--login", "-c"]
# Update package list and install necessary libraries
RUN apt-get update \
&& apt-get install -y \
bash \
bash-completion \
curl \
fish \
git \
jq \
locales \
nano \
python3-dev \
python3-pip \
python3-setuptools \
sudo \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Set the locale
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
WORKDIR /app
# Copy source code to container
COPY . .
# Add necessary stuff to bash autocomplete
RUN echo 'source /usr/share/bash-completion/bash_completion' >> /etc/bash.bashrc \
&& curl https://raw.githubusercontent.com/dsifford/yarn-completion/master/yarn-completion.bash >> /etc/bash.bashrc \
&& printf '\nNG_COMMANDS="add build config doc e2e generate help lint new run serve test update version xi18n"\ncomplete -W "$NG_COMMANDS" ng\n' >> /etc/bash.bashrc
# Link `ng` command, set entrypoint with `x` mark and install `ncu` and `mversion` tools
RUN ln -s /app/node_modules/.bin/ng /usr/local/bin/ng \
&& chmod +x docker-entrypoint-dev.sh
# Add node user to sudo group and set password to `node`
RUN usermod -a -G sudo node \
&& usermod -p $(perl -e 'print crypt($ARGV[0], "password")' 'node') node \
&& echo 'node ALL=(ALL) ALL' >> /etc/sudoers
RUN mkdir -p /home/node/.config/fish/completions \
&& mkdir -p /home/node/.config/fish/functions \
&& mkdir -p /home/node/.local/share \
&& chmod 777 -R /home/node
USER node
RUN pip3 install thefuck --user --no-warn-script-location --break-system-packages
RUN fish -c 'curl -sL git.io/fisher | source && fisher install jorgebucaran/fisher' \
&& fish -c 'fisher install jorgebucaran/nvm.fish'
COPY ./docker/fish /home/node/.config/fish/
USER root
RUN chmod 777 -R /home/node /tmp \
&& rm -rf /tmp/fish.node
USER node
# Add necessary stuff to bash autocomplete
ENV PATH "$PATH:/home/node/.local/bin"
ENV XDG_RUNTIME_PATH /home/node/.tmp
RUN echo 'eval "$(thefuck --alias)"' >> /home/node/.bashrc
# Expose port 4200 outside
EXPOSE 4200
# Set custom entrypoint for dev container
ENTRYPOINT ["/app/docker-entrypoint-dev.sh"]