-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
31 lines (23 loc) · 889 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
FROM node:6.9.4-alpine
MAINTAINER Clevertech DevOps <support@clevertech.biz>
# Update OS
RUN apk --no-cache add ca-certificates wget && update-ca-certificates
# Install yarn
RUN mkdir -p /opt/yarn && cd /opt/yarn && wget https://yarnpkg.com/latest.tar.gz && tar zxf latest.tar.gz
ENV PATH "$PATH:/opt/yarn/dist/bin"
EXPOSE 3000
CMD ["node", "src/index.js"]
# Create the working dir
RUN mkdir -p /opt/app && mkdir /cache
WORKDIR /opt/app
# Do not use cache when we change node dependencies in package.json
ADD package.json yarn.lock /cache/
# Copy cache contents (if any) from local machine
ADD .yarn-cache.tgz /
# Install packages + Prepare cache file
RUN cd /cache \
&& yarn config set cache-folder /usr/local/share/.cache/yarn \
&& yarn \
&& cd /opt/app && ln -s /cache/node_modules node_modules \
&& tar czf /.yarn-cache.tgz /usr/local/share/.cache/yarn
COPY . /opt/app