2020-02-06 03:04:43 +00:00
|
|
|
# Install the base requirements for the app.
|
|
|
|
# This stage is to support development.
|
2023-02-10 04:49:59 +00:00
|
|
|
ARG BUILDPLATFORM="linux/amd64"
|
2023-02-10 04:53:03 +00:00
|
|
|
ARG TARGETPLATFORM="linux/amd64"
|
|
|
|
|
2022-12-22 20:52:21 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM python:alpine AS base
|
2023-05-30 23:02:23 +00:00
|
|
|
ENV http_proxy http://proxy-chain.xxx.com:911/
|
|
|
|
ENV https_proxy http://proxy-chain.xxx.com:912/
|
2020-02-06 03:04:43 +00:00
|
|
|
WORKDIR /app
|
|
|
|
COPY requirements.txt .
|
2023-05-31 02:16:14 +00:00
|
|
|
|
|
|
|
RUN ping -c5 8.8.8.8
|
|
|
|
RUN ping -c5 208.67.222.222
|
|
|
|
RUN ifconfig
|
|
|
|
RUN uname -a
|
|
|
|
RUN cat /etc/resolv.conf
|
|
|
|
RUN route
|
|
|
|
RUN ip address
|
|
|
|
RUN ip route
|
|
|
|
RUN nslookup google.com
|
2023-05-31 02:33:01 +00:00
|
|
|
RUN apk update
|
2023-05-31 02:43:16 +00:00
|
|
|
RUN apk add --no-cache curl dig
|
|
|
|
RUN dig https://google.com
|
2023-05-31 02:16:14 +00:00
|
|
|
RUN curl -IL google.com
|
|
|
|
RUN curl ifconfig.me
|
|
|
|
|
|
|
|
|
2023-05-31 02:20:29 +00:00
|
|
|
|
|
|
|
|
2023-05-31 02:27:40 +00:00
|
|
|
RUN pip3 install --default-timeout=100 -r requirements.txt
|
2020-02-06 03:04:43 +00:00
|
|
|
|
2022-12-22 20:52:21 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM node:18-alpine AS app-base
|
2020-02-06 03:04:43 +00:00
|
|
|
WORKDIR /app
|
|
|
|
COPY app/package.json app/yarn.lock ./
|
|
|
|
COPY app/spec ./spec
|
|
|
|
COPY app/src ./src
|
2021-11-10 08:17:07 +00:00
|
|
|
|
|
|
|
# Run tests to validate app
|
|
|
|
FROM app-base AS test
|
|
|
|
RUN yarn install
|
2020-02-06 03:04:43 +00:00
|
|
|
RUN yarn test
|
|
|
|
|
|
|
|
# Clear out the node_modules and create the zip
|
|
|
|
FROM app-base AS app-zip-creator
|
2022-11-23 04:27:02 +00:00
|
|
|
COPY --from=test /app/package.json /app/yarn.lock ./
|
2021-11-10 08:17:07 +00:00
|
|
|
COPY app/spec ./spec
|
|
|
|
COPY app/src ./src
|
|
|
|
RUN apk add zip && \
|
2020-02-06 03:04:43 +00:00
|
|
|
zip -r /app.zip /app
|
|
|
|
|
|
|
|
# Dev-ready container - actual files will be mounted in
|
2022-12-22 20:52:21 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM base AS dev
|
2020-02-06 03:04:43 +00:00
|
|
|
CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"]
|
|
|
|
|
|
|
|
# Do the actual build of the mkdocs site
|
2022-12-22 20:52:21 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM base AS build
|
2020-02-06 03:04:43 +00:00
|
|
|
COPY . .
|
|
|
|
RUN mkdocs build
|
|
|
|
|
|
|
|
# Extract the static content from the build
|
|
|
|
# and use a nginx image to serve the content
|
2022-12-22 20:52:21 +00:00
|
|
|
FROM --platform=$TARGETPLATFORM nginx:alpine
|
2020-02-06 03:04:43 +00:00
|
|
|
COPY --from=app-zip-creator /app.zip /usr/share/nginx/html/assets/app.zip
|
|
|
|
COPY --from=build /app/site /usr/share/nginx/html
|