Skip to content

Commit

Permalink
#12 changes swaggerui installation process
Browse files Browse the repository at this point in the history
  • Loading branch information
cwolfes committed Apr 13, 2022
1 parent 44f659d commit 9bc6084
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 31 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "swagger-ui"]
path = swagger-ui
url = https://github.com/cloudogu/swagger-ui.git
54 changes: 27 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
FROM node:10 AS build
# separate COPY and RUN commands to use docker build cache
COPY swagger-ui/package.json /usr/share/build/swagger-ui/package.json
COPY swagger-ui/package-lock.json /usr/share/build/swagger-ui/package-lock.json
WORKDIR /usr/share/build/swagger-ui
RUN npm i
COPY / /usr/share/build/
RUN npm run build

FROM registry.cloudogu.com/official/base:3.15.3-1
LABEL NAME="official/swaggerui" \
VERSION="3.25.0-2" \
VERSION="4.9.0-1" \
maintainer="[email protected]"

ENV SERVICE_TAGS=webapp
ENV SERVICE_TAGS=webapp \
SWAGGERUI_VERSION=4.9.0-1 \
SWAGGERUI_ZIP_SHA256="0bfecf30a09247936eed6ec2d5d8ddba3b1a847e24017cd3876ddce5b33736ce" \
NGINX_HOME="/var/www/html"

COPY resources /

RUN set -x -o errexit -o nounset -o pipefail \
&& apk update \
&& apk upgrade \
# install required packages
&& apk --update add openssl pcre zlib nginx \
# change owner of nginx binary
&& chown root:root /usr/sbin/nginx \
# redirect logs
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
# cleanup apk cache
&& rm -rf /var/cache/apk/* \
&& mkdir -p /var/www/html
&& apk update \
&& apk upgrade \
# install required packages
&& apk --update add openssl pcre zlib nginx \
# change owner of nginx binary
&& chown root:root /usr/sbin/nginx \
# redirect logs
&& ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log \
# cleanup apk cache
&& rm -rf /var/cache/apk/* \
&& mkdir -p ${NGINX_HOME} \
# install swaggerui from fork https://github.com/cloudogu/swagger-ui/releases/ \
&& curl -Lsk --fail --silent --location --retry 3 https://github.com/cloudogu/swagger-ui/releases/download/v${SWAGGERUI_VERSION}/swagger-ui-${SWAGGERUI_VERSION}.zip -o /tmp/swagger-ui.zip \
&& echo "${SWAGGERUI_ZIP_SHA256} */tmp/swagger-ui.zip" | sha256sum -c - \
&& unzip /tmp/swagger-ui.zip -d ${NGINX_HOME} \
&& mv ${NGINX_HOME}/dist/* ${NGINX_HOME} \
# cleanup
&& rm -r ${NGINX_HOME}/dist && rm /tmp/swagger-ui.zip

# copy files
COPY resources /
COPY --from=build /usr/share/build/swagger-ui/dist/* /var/www/html/

# Define working directory.
WORKDIR /etc/nginx

Expand All @@ -41,4 +41,4 @@ HEALTHCHECK CMD doguctl healthy swaggerui || exit 1
EXPOSE 8080

# Define default command.
CMD ["/startup.sh"]
CMD ["/startup.sh"]
1 change: 0 additions & 1 deletion swagger-ui
Submodule swagger-ui deleted from e69cf4

0 comments on commit 9bc6084

Please sign in to comment.