Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (44 loc) · 2.07 KB
/
Copy pathDockerfile
File metadata and controls
67 lines (44 loc) · 2.07 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# syntax=docker/dockerfile:1
ARG SWIFT_VERSION=5.10.1
FROM swift:${SWIFT_VERSION} AS base
WORKDIR /src
RUN <<EOF
apt-get update
apt-get install -y python3 python3-pip sqlite3 libsqlite3-dev
EOF
RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \
pip install -r requirements.txt
RUN --mount=type=cache,target=/swift-cache \
--mount=type=bind,source=Package.swift,target=Package.swift \
swift package --cache-path /swift-cache resolve
FROM scratch AS export-package-resolved
COPY --from=base /src/Package.resolved Package.resolved
FROM base AS build
RUN --mount=type=cache,target=/swift-cache \
--mount=type=bind,source=./Sources,target=/src/Sources \
--mount=type=bind,source=./Tests,target=/src/Tests \
--mount=type=bind,source=./Package.swift,target=/src/Package.swift \
--mount=type=bind,source=./Package.resolved,target=/src/Package.resolved \
swift build --cache-path /swift-cache --configuration release
FROM build AS test
RUN --mount=type=cache,target=/swift-cache \
--mount=type=bind,source=./Sources,target=/src/Sources \
--mount=type=bind,source=./Tests,target=/src/Tests \
--mount=type=bind,source=./python-modules,target=/src/python-modules \
--mount=type=bind,source=./Package.swift,target=/src/Package.swift \
--mount=type=bind,source=./Package.resolved,target=/src/Package.resolved \
--mount=type=bind,source=./db/init,target=/src/db/init \
swift test --cache-path /swift-cache --configuration release
FROM swift:${SWIFT_VERSION}-slim AS data-quality-simulator
WORKDIR /app
RUN <<EOF
apt-get update
apt-get install -y python3 python3-pip sqlite3 libsqlite3-dev
EOF
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=requirements.txt,target=requirements.txt \
pip install -r requirements.txt
COPY ./python-modules/* /app/python-modules/
COPY --from=build /src/.build/x86_64-unknown-linux-gnu/release/DataBalanceSimulator /app/DataBalanceSimulator
ENTRYPOINT ["/app/DataBalanceSimulator"]
CMD ["--config-file-path", "/app/config-files/base_config.json"]