-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (36 loc) · 1.32 KB
/
Dockerfile
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
FROM --platform=x86_64 golang:1.17.0-buster AS development
# ================= SAP RFC Configuration ======================
RUN mkdir -p /usr/local/sap
COPY ./sap-nw-sdk.tar.gz .
RUN tar -zxf sap-nw-sdk.tar.gz --directory /usr/local/sap
RUN rm sap-nw-sdk.tar.gz
ENV SAPNWRFC_HOME=/usr/local/sap/nwrfcsdk
RUN echo "/usr/local/sap/nwrfcsdk/lib" > /etc/ld.so.conf.d/nwrfcsdk.conf
RUN ldconfig -v | grep sap
# ==============================================================
RUN mkdir -p /app
RUN mkdir -p /data
WORKDIR /app
FROM --platform=x86_64 golang:1.17.0-buster AS production
# ================= SAP RFC Configuration ======================
RUN mkdir -p /usr/local/sap
COPY ./sap-nw-sdk.tar.gz .
RUN tar -zxf sap-nw-sdk.tar.gz --directory /usr/local/sap
RUN rm sap-nw-sdk.tar.gz
ENV SAPNWRFC_HOME=/usr/local/sap/nwrfcsdk
RUN echo "/usr/local/sap/nwrfcsdk/lib" > /etc/ld.so.conf.d/nwrfcsdk.conf
RUN ldconfig -v | grep sap
# ==============================================================
RUN useradd -ms /bin/bash user
USER user
RUN mkdir -p /home/user/app
WORKDIR /home/user/app
COPY --chown=user:user go.mod ./
COPY --chown=user:user go.sum ./
RUN go mod download
COPY --chown=user:user . .
RUN go build -tags=jsoniter -o /home/user/sap-bridge .
RUN rm -rf /home/user/app
ENV GIN_MODE=release
EXPOSE 80
ENTRYPOINT [ "/home/user/sap-bridge" ]