redoc/config/docker/Dockerfile
Alex Varchuk c01c6876f2
feat: initialize release candidate for v3.0.0
Co-authored-by: Roman Hotsiy <gotsijroman@gmail.com>
Co-authored-by: Alex Varchuk <olexandr.varchuk@gmail.com>
Co-authored-by: Oprysk Vyacheslav <vyacheslav@redocly.com>
Co-authored-by: Ivan Kropyvnytskyi <130547411+ivankropyvnytskyi@users.noreply.github.com>
Co-authored-by: Yevhen Pylyp <yevhen.pylyp@redocly.com>
Co-authored-by: Vladyslav Makarenko <vladyslav.makarenko@redocly.com>
Co-authored-by: Yevhenii Medviediev <yevhenii.medviediev@redocly.com>
Co-authored-by: Oleksii Horbachevskyi <oleksii.horbachevskyi@redocly.com>
Co-authored-by: volodymyr-rutskyi <rutskyi.v@gmail.com>
Co-authored-by: Adam Altman <adam@redoc.ly>
Co-authored-by: Andrew Tatomyr <andrew.tatomyr@redocly.com>
Co-authored-by: Anastasiia Derymarko <anastasiia@redocly.com>
Co-authored-by: Roman Marshevskyy <roman.marshevskyy@redoc.ly>
Co-authored-by: Lorna Mitchell <lorna.mitchell@redocly.com>
Co-authored-by: Taylor Krusen <taylor.krusen@redocly.com>
2025-10-24 17:40:43 +02:00

52 lines
1.7 KiB
Docker

# 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
FROM node:22.20.0-alpine@sha256:dbcedd8aeab47fbc0f4dd4bffa55b7c3c729a707875968d467aaaea42d6225af AS build
WORKDIR /build
COPY . .
RUN npm ci --no-optional --ignore-scripts --no-fund --omit=dev \
&& npm install --no-save vite
RUN npm run build:standalone && npm run minify
FROM nginx:1.28-alpine@sha256:8f2bcf97c473dfe311e79a510ee540ee02e28ce1e6a64e1ef89bfad32574ef10
ENV PAGE_TITLE="ReDoc"
ENV PAGE_FAVICON="favicon.png"
ENV BASE_PATH=
ENV SPEC_URL="https://cdn.redocly.com/redoc/museum-api.yaml"
ENV PORT=80
ENV HOST=localhost
ENV REDOC_OPTIONS=
# add docker-entrypoint scripts
COPY config/docker/docker-entrypoint.d/ /docker-entrypoint.d/
RUN chmod -R +x /docker-entrypoint.d/
# copy nginx config
COPY config/docker/nginx/templates/ /etc/nginx/templates/
COPY config/docker/nginx/nginx.conf config/docker/nginx/handle_options.conf config/docker/nginx/security.conf /etc/nginx/
# copy static files
COPY config/docker/static/ /usr/share/nginx/html/
COPY --from=build /build/bundle/redoc.standalone.js /usr/share/nginx/html/
# 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