-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
81 lines (66 loc) 路 3.56 KB
/
Copy pathDockerfile
File metadata and controls
81 lines (66 loc) 路 3.56 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
FROM debian:trixie-slim
# METADATA #####################################################################
LABEL maintainer="dockette <https://github.com/dockette>"
LABEL description="Dockerized OpenAPI documentation viewer with Swagger UI, Redoc, Stoplight Elements, RapiDoc and Scalar"
# VERSIONS #####################################################################
ENV SWAGGER_UI_VERSION=5.33.0
ENV REDOC_VERSION=2.5.4
ENV STOPLIGHT_ELEMENTS_VERSION=9.0.25
ENV RAPIDOC_VERSION=9.3.8
ENV SCALAR_VERSION=1.72.1
# INSTALLATION #################################################################
RUN apt update && \
apt dist-upgrade -y
# DEPENDENCIES #################################################################
RUN apt install -y \
wget \
curl \
ca-certificates \
unzip && \
# CLEAN UP #################################################################
apt-get clean -y && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* /var/lib/log/* /tmp/* /var/tmp/*
# CADDY ########################################################################
RUN apt update && \
apt install -y debian-keyring debian-archive-keyring apt-transport-https && \
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg && \
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list && \
apt update && \
apt install -y caddy && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# DOCUMENT ROOT ################################################################
RUN mkdir -p /srv/www
# SWAGGER UI ###################################################################
RUN curl -sSL -o /tmp/swagger-ui.tar.gz \
https://github.com/swagger-api/swagger-ui/archive/refs/tags/v${SWAGGER_UI_VERSION}.tar.gz && \
tar -xzf /tmp/swagger-ui.tar.gz -C /tmp && \
mv /tmp/swagger-ui-${SWAGGER_UI_VERSION}/dist /srv/www/swagger && \
rm -rf /tmp/swagger-ui* && \
rm -f /srv/www/swagger/index.html /srv/www/swagger/swagger-initializer.js
# REDOC ########################################################################
RUN mkdir -p /srv/www/redoc && \
curl -sSL -o /srv/www/redoc/redoc.js \
https://cdn.redoc.ly/redoc/v${REDOC_VERSION}/bundles/redoc.standalone.js
# STOPLIGHT ELEMENTS ###########################################################
RUN mkdir -p /srv/www/elements && \
curl -sSL -o /srv/www/elements/elements.js \
https://unpkg.com/@stoplight/elements@${STOPLIGHT_ELEMENTS_VERSION}/web-components.min.js && \
curl -sSL -o /srv/www/elements/elements.css \
https://unpkg.com/@stoplight/elements@${STOPLIGHT_ELEMENTS_VERSION}/styles.min.css
# RAPIDOC ######################################################################
RUN mkdir -p /srv/www/rapidoc && \
curl -sSL -o /srv/www/rapidoc/rapidoc.js \
https://unpkg.com/rapidoc@${RAPIDOC_VERSION}/dist/rapidoc-min.js
# SCALAR #######################################################################
RUN mkdir -p /srv/www/scalar && \
curl -sSL -o /srv/www/scalar/scalar.js \
https://cdn.jsdelivr.net/npm/@scalar/api-reference@${SCALAR_VERSION}/dist/browser/standalone.js
# HTML PAGES ###################################################################
COPY html/ /srv/www/
# CADDYFILE ####################################################################
COPY Caddyfile /etc/caddy/Caddyfile
EXPOSE 8000
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]