Tuesday, 25 February 2020

SAP NWRFCSDK Dockerfile with Golang

Here my working dockerfile for running a golang application depending on SAP/gorfc and the SAP Netweaver library

Compile with

GO111MODULE=on CGO_LDFLAGS_ALLOW=.* CGO_CFLAGS_ALLOW=.* CGO_CXXFLAGS_ALLOW=.*  \
CGO_CFLAGS='-I /usr/local/sap/nwrfcsdk/include' \
CGO_LDFLAGS='-L /usr/local/sap/nwrfcsdk/lib'  \
go build -a -o dist/myapp  cmd/main.go


Dockerfile

FROM debian:bullseye-slim

USER root
WORKDIR /app
EXPOSE 8080

COPY dist/myapp /bin
COPY .env /app
COPY nwrfcsdk.conf /etc/ld.so.conf.d/nwrfcsdk.conf
# unpack and install nwrfcsdk
ADD nwrfc750P_3-70002752.tar.gz /usr/local/sap/
RUN mkdir -p /usr/sap/ && ldconfig -v /usr/local/sap/nwrfcsdk/lib    

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/usr/local/sap/lib"
ENV LD_RUN_PATH=$LD_RUN_PATH:"/usr/local/sap/lib"
ENV SAPNWRFC_HOME="/usr/local/sap/nwrfcsdk"
ENV PATH="${PATH}:/usr/sap/nwrfcsdk/bin"

ENTRYPOINT [ "/bin/myapp" ]

No comments:

Post a Comment

Chipmaster Gear Cutting

  Calculate all the possible gear combinations for the gear selector to cut a 15TPI thread: Imperial TPI C 5 24 20 Imperial TPI ...