2021-11-26 13:23:29 +01:00
|
|
|
# stage 1 generator - implementation code
|
|
|
|
FROM python:3.10.0-bullseye AS stage1-builder
|
|
|
|
|
|
|
|
RUN mkdir /tmp/work && chown 1000 /tmp/work
|
|
|
|
|
2021-11-26 17:11:00 +01:00
|
|
|
COPY openapi.yaml /tmp/work/
|
2021-12-02 12:10:01 +01:00
|
|
|
COPY serviceErrorCodes.yaml /tmp/work/
|
2021-11-26 17:11:00 +01:00
|
|
|
COPY generateAll.sh /tmp/work/
|
|
|
|
COPY ENV /tmp/work/
|
|
|
|
COPY *.cs.tmpl /tmp/work/
|
|
|
|
COPY generate.py /tmp/work/
|
|
|
|
COPY generateHelper.py /tmp/work/
|
2021-11-26 13:23:29 +01:00
|
|
|
|
|
|
|
RUN \
|
|
|
|
pip install Cheetah3 && \
|
|
|
|
pip install PyYAML
|
|
|
|
|
|
|
|
USER 1000
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
cd /tmp/work && \
|
|
|
|
./generateAll.sh -r1
|
|
|
|
|
|
|
|
|
|
|
|
# stage 2 generator - openapi server stubs code and integration
|
|
|
|
# with implementation and database code
|
|
|
|
FROM openapitools/openapi-generator-cli:v5.3.0 AS stage2-builder
|
|
|
|
|
|
|
|
RUN mkdir /tmp/work && chown 1000 /tmp/work
|
|
|
|
|
|
|
|
USER 1000
|
|
|
|
|
2021-11-26 17:11:00 +01:00
|
|
|
COPY openapi.yaml /tmp/work/
|
|
|
|
COPY generateAll.sh /tmp/work/
|
|
|
|
COPY ENV /tmp/work/
|
|
|
|
COPY DbService.cs /tmp/work/
|
|
|
|
COPY --from=stage1-builder /tmp/work/*.cs /tmp/work/
|
2021-11-26 13:23:29 +01:00
|
|
|
RUN cd /tmp/work && ./generateAll.sh -k2c
|
|
|
|
|
|
|
|
|
|
|
|
# final container
|
|
|
|
FROM wollud1969/dotnetcore5sdk:1.0.0
|
|
|
|
|
2021-12-06 17:53:31 +01:00
|
|
|
ENV Database__InfoFile "/opt/service/config/databaseInfo.json"
|
2021-12-15 15:35:54 +01:00
|
|
|
ENV Logging__LogLevel__Default "Information"
|
2021-12-06 17:53:31 +01:00
|
|
|
|
2021-11-26 13:23:29 +01:00
|
|
|
RUN \
|
|
|
|
useradd -d /opt/service -m service && \
|
2021-12-06 17:49:07 +01:00
|
|
|
mkdir /opt/service/output && chown service:service /opt/service/output && \
|
|
|
|
mkdir /opt/service/config && chown service:service /opt/service/config
|
2021-11-26 13:23:29 +01:00
|
|
|
|
|
|
|
USER service
|
|
|
|
WORKDIR /opt/service
|
|
|
|
|
2021-11-26 17:11:00 +01:00
|
|
|
COPY generateAll.sh ./
|
|
|
|
COPY ENV ./
|
|
|
|
COPY --from=stage2-builder /tmp/work/output/ ./output/
|
2021-11-26 13:23:29 +01:00
|
|
|
RUN ./generateAll.sh -kb
|
|
|
|
|
|
|
|
EXPOSE 8080
|
2021-12-06 17:49:07 +01:00
|
|
|
VOLUME /opt/service/config
|
2021-11-26 13:23:29 +01:00
|
|
|
|
|
|
|
CMD [ "./generateAll.sh", "-kx" ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|