Skip to content

Commit c8d449d

Browse files
committed
Improve rebuild image 2 step
1 parent f77c075 commit c8d449d

File tree

2 files changed

+29
-27
lines changed

2 files changed

+29
-27
lines changed

.github/workflows/deploy.yaml

+25-24
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
branches:
77
- main
88
- dev
9+
- improve-build-cache
910

1011
jobs:
1112
deploy:
@@ -94,30 +95,30 @@ jobs:
9495
run: |
9596
docker build --tag $SM_DOCKER -f deploy/api/Dockerfile .
9697
97-
- name: Build python package
98-
run: python setup.py sdist
98+
# - name: Build python package
99+
# run: python setup.py sdist
99100

100-
- name: "push server image"
101-
run: |
102-
docker push $SM_DOCKER
101+
# - name: "push server image"
102+
# run: |
103+
# docker push $SM_DOCKER
103104

104-
- name: "deploy to Cloud Run"
105-
run: |
106-
if [[ $GITHUB_REF == 'refs/heads/main' ]]; then
107-
gcloud_deploy_name=sample-metadata-api
108-
else
109-
gcloud_deploy_name=sample-metadata-api-dev
110-
fi
111-
gcloud run deploy \
112-
$gcloud_deploy_name --image $SM_DOCKER \
113-
--region australia-southeast1 --no-allow-unauthenticated \
114-
--platform managed
105+
# - name: "deploy to Cloud Run"
106+
# run: |
107+
# if [[ $GITHUB_REF == 'refs/heads/main' ]]; then
108+
# gcloud_deploy_name=sample-metadata-api
109+
# else
110+
# gcloud_deploy_name=sample-metadata-api-dev
111+
# fi
112+
# gcloud run deploy \
113+
# $gcloud_deploy_name --image $SM_DOCKER \
114+
# --region australia-southeast1 --no-allow-unauthenticated \
115+
# --platform managed
115116

116-
- name: Publish package
117-
if: github.ref == 'refs/heads/main'
118-
uses: pypa/gh-action-pypi-publish@release/v1
119-
with:
120-
user: __token__
121-
password: ${{ secrets.PYPI_API_TOKEN }}
122-
packages-dir: dist/
123-
skip-existing: true
117+
# - name: Publish package
118+
# if: github.ref == 'refs/heads/main'
119+
# uses: pypa/gh-action-pypi-publish@release/v1
120+
# with:
121+
# user: __token__
122+
# password: ${{ secrets.PYPI_API_TOKEN }}
123+
# packages-dir: dist/
124+
# skip-existing: true

deploy/api/Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ ENV PYTHONUNBUFFERED 1
1212
EXPOSE $PORT
1313

1414
WORKDIR /app/sample_metadata/
15-
COPY requirements.txt requirements.txt
1615

1716
RUN apt-get update && \
1817
apt-get install -y wget bash bzip2 zip build-essential && \
1918
rm -r /var/lib/apt/lists/* /var/cache/apt/* && \
2019
wget -qO- https://api.anaconda.org/download/conda-forge/micromamba/0.8.2/linux-64/micromamba-0.8.2-he9b6cbd_0.tar.bz2 | tar -xvj -C /usr/local bin/micromamba && \
2120
mkdir $MAMBA_ROOT_PREFIX && \
2221
micromamba install -y --prefix $MAMBA_ROOT_PREFIX -c conda-forge \
23-
python=3.10 pip && \
24-
pip install -r requirements.txt && \
22+
python=3.10 pip
23+
24+
COPY requirements.txt requirements.txt
25+
RUN pip install -r requirements.txt && \
2526
rm -r /root/micromamba/pkgs
2627

2728
COPY api api

0 commit comments

Comments
 (0)