-
Notifications
You must be signed in to change notification settings - Fork 167
/
Dockerfile
49 lines (40 loc) · 978 Bytes
/
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
49
FROM mhart/alpine-node:8
# Install required dependencies (Alpine Linux packages)
RUN apk update && \
apk add --no-cache \
sudo \
g++ \
gcc \
git \
libev-dev \
libevent-dev \
libuv-dev \
make \
openssl-dev \
perl \
python
# Add user and make it sudoer
ARG uid=1000
ARG user=username
RUN set -x ; \
addgroup -g $uid -S $user ; \
adduser -u $uid -D -S -G $user $user \
&& exit 0 ; exit 1
RUN echo $user' ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Install (global) Yarn packages/dependencies
RUN yarn global add node-gyp
RUN git clone --recursive https://github.com/sass/node-sass.git \
&& cd node-sass \
&& yarn \
&& node scripts/build -f
# Make project directory with permissions
RUN mkdir /project
# Switch to project directory
WORKDIR /project
# Copy required stuff
COPY . .
# Give owner rights to the current user
RUN chown -Rh $user:$user /project
# Install (local) Yarn packages and build
RUN yarn
USER $user