Skip to Content
Technical Articles

OpenUI5: Serve SDK from a Docker image.

Ever wanted to serve the OpenUI5 SDK from a docker image?

Just make sure you have Docker up an running so that you can build the image using this Dockerfile:

FROM nginx:1.15.8-alpine

#https://openui5.hana.ondemand.com/downloads/openui5-sdk-1.61.2.zip

ARG ui5_version="1.61.2"
ARG ui5_filename="openui5-sdk-${ui5_version}.zip"
ARG ui5_url="https://openui5.hana.ondemand.com/downloads/${ui5_filename}"

RUN apk add --no-cache --virtual .sdk wget unzip

RUN mkdir -p /var/www

RUN wget ${ui5_url} --no-check-certificate -P /var/www

RUN unzip -o /var/www/${ui5_filename} -d /var/www

RUN apk del .sdk

RUN rm /var/www/${ui5_filename}

COPY ./nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 80

The specified OpenUI5 SDK version (1.61.2) will be downloaded and unzipped for your convenience.

All files will be served using Nginx, we just have to provide a proper nginx.conf file:

server {
    listen 80;
    root /var/www/;

    # avoid caching
    # see https://stackoverflow.com/questions/40243633/disable-nginx-cache-for-javascript-files
    add_header Last-Modified $date_gmt;
    add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
    if_modified_since off;
    expires off;
    etag off;
}

If you want to use Docker Compose your docker-compose.yml could look like this:

version: '2.1'

services:
  openui5_sdk:
    build:
      context: ./
      args:
        ui5_version: "1.61.2"
    restart: always
    ports:
      - 5000:80

Simply change the ui5_version and port mapping (5000:80) to your needs.

After running docker-compose up -d –build you should be able to browse to e.g.  http://localhost:5000 or http://localhost:5000/resources/sap-ui-core.js

Couldn’t be easier than that!

All files can be found here: https://github.com/pwasem/openui5-sdk-docker

Enjoy!

 

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.