-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
38 lines (28 loc) · 1.02 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
FROM node:8
MAINTAINER Christian Metz <[email protected]>
ENV SWAGGER_UI_VERSION 3.2.2
ENV SWAGGER_SPEC_PATH /swaggerui/swagger/
# Create app directories and install unzip
RUN mkdir -p /usr/src/app && \
mkdir -p /swaggerui/swagger && \
apt-get update && \
apt-get install -y unzip
WORKDIR /swaggerui
# Download Swagger UI
ADD https://github.com/swagger-api/swagger-ui/archive/v${SWAGGER_UI_VERSION}.zip /swaggerui/${SWAGGER_UI_VERSION}.zip
COPY src/swagger.json /swaggerui/swagger/swagger.json
# Unzip Swagger archive, copy dist files, and change the default endpoint
# from petstore to the local API
RUN unzip ${SWAGGER_UI_VERSION}.zip && \
rm ${SWAGGER_UI_VERSION}.zip && \
mv swagger-ui-${SWAGGER_UI_VERSION}/dist/* . && \
rm -r swagger-ui-${SWAGGER_UI_VERSION}/ && \
sed -i "s|http://petstore.swagger.io/v2/swagger.json|/spec|g" index.html
WORKDIR /usr/src/app
# Install app dependencies
COPY src/package.json .
RUN npm install
# Bundle app source
COPY src/server.js .
EXPOSE 8080
CMD ["npm", "start"]