Skip to content

Commit dbbce28

Browse files
[CDAPI-78]: Added new virtual environment for use by the mocks
1 parent c16d7c9 commit dbbce28

File tree

5 files changed

+45
-5
lines changed

5 files changed

+45
-5
lines changed

Makefile

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,39 @@ dockerNetwork := pathology-local
1717
# Example CI/CD targets are: dependencies, build, publish, deploy, clean, etc.
1818

1919
.PHONY: dependencies
20+
.ONESHELL:
2021
dependencies: # Install dependencies needed to build and test the project @Pipeline
21-
@cd pathology-api && poetry sync
22-
@cd ../mocks && poetry sync
22+
if [[ "$${IN_BUILD_CONTAINER}" == "true" ]]; then \
23+
eval "$$(pyenv init -)"; \
24+
pyenv activate pathology; \
25+
fi
26+
27+
cd pathology-api && poetry sync
28+
cd ../
29+
30+
if [[ "$${IN_BUILD_CONTAINER}" == "true" ]]; then \
31+
pyenv deactivate pathology; \
32+
fi
33+
34+
if [[ "$${IN_BUILD_CONTAINER}" == "true" ]]; then \
35+
pyenv activate pathology-mocks; \
36+
fi
37+
38+
cd mocks && poetry sync
39+
cd ../
40+
41+
if [[ "$${IN_BUILD_CONTAINER}" == "true" ]]; then \
42+
pyenv deactivate pathology-mocks; \
43+
fi
2344

2445
.PHONY: build-pathology
46+
.ONESHELL:
2547
build-pathology:
48+
@if [[ "$${IN_BUILD_CONTAINER}" == "true" ]]; then \
49+
eval "$$(pyenv init -)"; \
50+
pyenv activate pathology; \
51+
fi
52+
2653
@cd pathology-api
2754
@echo "Starting build for pathology API..."
2855
@echo "Running type checks..."
@@ -37,8 +64,18 @@ build-pathology:
3764
@cd ./target/pathology-api
3865
@zip -r "../artifact.zip" .
3966

67+
@if [[ "$${IN_BUILD_CONTAINER}" == "true" ]]; then \
68+
pyenv deactivate pathology; \
69+
fi
70+
4071
.PHONY: build-mocks
72+
.ONESHELL:
4173
build-mocks:
74+
@if [[ "$${IN_BUILD_CONTAINER}" == "true" ]]; then \
75+
eval "$$(pyenv init -)"; \
76+
pyenv activate pathology-mocks; \
77+
fi
78+
4279
@cd mocks
4380
@echo "Starting build for mocks..."
4481
@echo "Running type checks..."
@@ -53,6 +90,10 @@ build-mocks:
5390
@cd ./target/mocks
5491
@zip -r "../artifact.zip" .
5592

93+
@if [[ "$${IN_BUILD_CONTAINER}" == "true" ]]; then \
94+
pyenv deactivate pathology-mocks; \
95+
fi
96+
5697
.PHONY: build
5798
build: clean-artifacts dependencies build-pathology build-mocks
5899
@echo "Built artifacts for both pathology and mocks"

infrastructure/images/build-container/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ ENV PATH="$PIPX_BIN_DIR:$PATH"
133133

134134
# Create a virtual environment for development
135135
RUN bash -c "source ~/.bashrc && pyenv virtualenv ${PYTHON_VERSION} pathology" \
136+
&& bash -c "source ~/.bashrc && pyenv virtualenv ${PYTHON_VERSION} pathology-mocks" \
136137
# Install markdownlint-cli
137138
&& npm install -g --ignore-scripts markdownlint-cli \
138139
&& export PATH \

infrastructure/images/build-container/resources/.bashrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,4 @@ export PATH="/pipx/bin:$PATH"
1414
eval "$(pyenv init -)"
1515
eval "$(pyenv virtualenv-init -)"
1616

17-
# Auto-activate pathology environment
18-
pyenv shell pathology 2>/dev/null || true
19-
2017
alias docker="doas docker"

mocks/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pathology-mocks

0 commit comments

Comments
 (0)