2018-06-25 14:10:29 +03:00
|
|
|
# To run:
|
|
|
|
# docker build -t redoc .
|
|
|
|
# docker run -it --rm -p 80:80 -e SPEC_URL='http://localhost:8000/swagger.yaml' redoc
|
|
|
|
# Ensure http://localhost:8000/swagger.yaml is served with cors. A good solution is:
|
|
|
|
# npm i -g http-server
|
|
|
|
# http-server -p 8000 --cors
|
|
|
|
|
2024-09-13 11:17:02 +03:00
|
|
|
FROM node:18-alpine
|
2018-06-25 14:10:29 +03:00
|
|
|
|
2020-03-17 12:06:03 +03:00
|
|
|
RUN apk update && apk add --no-cache git
|
2018-06-25 14:10:29 +03:00
|
|
|
|
2018-11-06 16:24:12 +03:00
|
|
|
# Install dependencies
|
2018-06-25 14:10:29 +03:00
|
|
|
WORKDIR /build
|
2020-03-17 12:06:03 +03:00
|
|
|
COPY package.json package-lock.json /build/
|
2022-05-12 16:52:16 +03:00
|
|
|
RUN npm ci --no-optional --ignore-scripts
|
2018-11-06 16:24:12 +03:00
|
|
|
|
|
|
|
# copy only required for the build files
|
|
|
|
COPY src /build/src
|
2021-07-20 15:18:21 +03:00
|
|
|
COPY webpack.config.ts tsconfig.json custom.d.ts /build/
|
|
|
|
COPY config/webpack-utils.ts /build/config/
|
2018-11-06 16:24:12 +03:00
|
|
|
COPY typings/styled-patch.d.ts /build/typings/styled-patch.d.ts
|
|
|
|
|
2018-06-25 14:10:29 +03:00
|
|
|
RUN npm run bundle:standalone
|
|
|
|
|
|
|
|
FROM nginx:alpine
|
|
|
|
|
|
|
|
ENV PAGE_TITLE="ReDoc"
|
|
|
|
ENV PAGE_FAVICON="favicon.png"
|
2022-04-27 18:40:44 +03:00
|
|
|
ENV BASE_PATH=
|
2018-06-25 14:10:29 +03:00
|
|
|
ENV SPEC_URL="http://petstore.swagger.io/v2/swagger.json"
|
|
|
|
ENV PORT=80
|
|
|
|
ENV REDOC_OPTIONS=
|
|
|
|
|
|
|
|
# copy files to the nginx folder
|
|
|
|
COPY --from=0 build/bundles /usr/share/nginx/html
|
|
|
|
COPY config/docker/index.tpl.html /usr/share/nginx/html/index.html
|
|
|
|
COPY demo/favicon.png /usr/share/nginx/html/
|
|
|
|
COPY config/docker/nginx.conf /etc/nginx/
|
|
|
|
COPY config/docker/docker-run.sh /usr/local/bin
|
|
|
|
|
2020-10-13 14:47:58 +03:00
|
|
|
# Provide rights to the root group to write to nginx repositories (needed to run in OpenShift)
|
|
|
|
RUN chgrp -R 0 /etc/nginx && \
|
|
|
|
chgrp -R 0 /usr/share/nginx/html && \
|
|
|
|
chgrp -R 0 /var/cache/nginx && \
|
|
|
|
chgrp -R 0 /var/log/nginx && \
|
|
|
|
chgrp -R 0 /var/run && \
|
|
|
|
chmod -R g+rwX /etc/nginx && \
|
|
|
|
chmod -R g+rwX /usr/share/nginx/html && \
|
|
|
|
chmod -R g+rwX /var/cache/nginx && \
|
|
|
|
chmod -R g+rwX /var/log/nginx && \
|
|
|
|
chmod -R g+rwX /var/run
|
|
|
|
|
2018-06-25 14:10:29 +03:00
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
CMD ["sh", "/usr/local/bin/docker-run.sh"]
|