69 lines
1.4 KiB
Docker
69 lines
1.4 KiB
Docker
# stage 1 generator - implementation code
|
|
FROM python:3.10.0-bullseye AS stage1-builder
|
|
|
|
RUN mkdir /tmp/work && chown 1000 /tmp/work
|
|
|
|
COPY openapi.yaml /tmp/work/
|
|
COPY serviceErrorCodes.yaml /tmp/work/
|
|
COPY generateAll.sh /tmp/work/
|
|
COPY ENV /tmp/work/
|
|
COPY *.cs.tmpl /tmp/work/
|
|
COPY generate.py /tmp/work/
|
|
COPY generateHelper.py /tmp/work/
|
|
|
|
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
|
|
|
|
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/
|
|
RUN cd /tmp/work && ./generateAll.sh -k2c
|
|
|
|
|
|
# final container
|
|
FROM wollud1969/dotnetcore5sdk:1.0.0
|
|
|
|
ENV Database__Host "xxx"
|
|
ENV Database__User "xxx"
|
|
ENV Database__Password "xxx"
|
|
ENV Database__Name "xxx"
|
|
|
|
RUN \
|
|
useradd -d /opt/service -m service && \
|
|
mkdir /opt/service/output && chown service:service /opt/service/output
|
|
|
|
USER service
|
|
WORKDIR /opt/service
|
|
|
|
COPY generateAll.sh ./
|
|
COPY ENV ./
|
|
COPY --from=stage2-builder /tmp/work/output/ ./output/
|
|
RUN ./generateAll.sh -kb
|
|
|
|
EXPOSE 8080
|
|
|
|
CMD [ "./generateAll.sh", "-kx" ]
|
|
|
|
|
|
|
|
|
|
|