Spaces:
Sleeping
Sleeping
tmp files
Browse files- tmp/sampleDockerfile +40 -0
- tmp/sample_docker-compose.yml +12 -0
tmp/sampleDockerfile
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Install the base requirements for the app.
|
2 |
+
# This stage is to support development.
|
3 |
+
FROM --platform=$BUILDPLATFORM python:alpine AS base
|
4 |
+
WORKDIR /app
|
5 |
+
COPY requirements.txt .
|
6 |
+
RUN pip install -r requirements.txt
|
7 |
+
|
8 |
+
FROM --platform=$BUILDPLATFORM node:18-alpine AS app-base
|
9 |
+
WORKDIR /app
|
10 |
+
COPY app/package.json app/yarn.lock ./
|
11 |
+
COPY app/spec ./spec
|
12 |
+
COPY app/src ./src
|
13 |
+
|
14 |
+
# Run tests to validate app
|
15 |
+
FROM app-base AS test
|
16 |
+
RUN yarn install
|
17 |
+
RUN yarn test
|
18 |
+
|
19 |
+
# Clear out the node_modules and create the zip
|
20 |
+
FROM app-base AS app-zip-creator
|
21 |
+
COPY --from=test /app/package.json /app/yarn.lock ./
|
22 |
+
COPY app/spec ./spec
|
23 |
+
COPY app/src ./src
|
24 |
+
RUN apk add zip && \
|
25 |
+
zip -r /app.zip /app
|
26 |
+
|
27 |
+
# Dev-ready container - actual files will be mounted in
|
28 |
+
FROM --platform=$BUILDPLATFORM base AS dev
|
29 |
+
CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"]
|
30 |
+
|
31 |
+
# Do the actual build of the mkdocs site
|
32 |
+
FROM --platform=$BUILDPLATFORM base AS build
|
33 |
+
COPY . .
|
34 |
+
RUN mkdocs build
|
35 |
+
|
36 |
+
# Extract the static content from the build
|
37 |
+
# and use a nginx image to serve the content
|
38 |
+
FROM --platform=$TARGETPLATFORM nginx:alpine
|
39 |
+
COPY --from=app-zip-creator /app.zip /usr/share/nginx/html/assets/app.zip
|
40 |
+
COPY --from=build /app/site /usr/share/nginx/html
|
tmp/sample_docker-compose.yml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# version: "3.7"
|
2 |
+
|
3 |
+
# services:
|
4 |
+
# docs:
|
5 |
+
# build:
|
6 |
+
# context: .
|
7 |
+
# dockerfile: Dockerfile
|
8 |
+
# target: dev
|
9 |
+
# ports:
|
10 |
+
# - 8000:8000
|
11 |
+
# volumes:
|
12 |
+
# - ./:/app
|