forked from reactql/kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (39 loc) · 1.22 KB
/
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 debian:testing-slim
ENV EPHIMERAL_PACKAGES "build-essential dh-autoreconf curl xz-utils python"
ENV PACKAGES "libpng-dev git"
# Install apt packages (and clean up afterwards)
RUN apt-get update \
&& apt-get install -y apt-utils \
&& apt-get install -y ${EPHIMERAL_PACKAGES} ${PACKAGES} \
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get install -y nodejs
# Install app dependencies
WORKDIR /tmp
COPY package.json /tmp/
RUN npm config set registry http://registry.npmjs.org/
# Install yarn for dev and faster builds
RUN npm i -g yarn
RUN yarn install
# Clean up apt packages not needed
RUN apt-get remove --purge -y ${EPHIMERAL_PACKAGES} \
; apt-get autoremove -y ${EPHIMERAL_PACKAGES} \
; apt-get clean \
; apt-get autoclean \
; echo -n > /var/lib/apt/extended_states \
; rm -rf /var/lib/apt/lists/* \
; rm -rf /usr/share/man/?? \
; rm -rf /usr/share/man/??_*
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Bundle app source
COPY . /usr/src/app
RUN cp -a /tmp/node_modules /usr/src/app/
# Build distribution
RUN yarn run clean && yarn run build
# Set the default host/port
ENV HOST 0.0.0.0
ENV PORT 4000
EXPOSE 4000
# Start the server by default
CMD npm run server