-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from sireto/master
merge master to develop
- Loading branch information
Showing
2 changed files
with
26 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,9 @@ jobs: | |
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
@@ -44,7 +47,7 @@ jobs: | |
name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: ./delta-pdf-api/ | ||
context: ./delta-pdf-api | ||
push: true | ||
tags: | | ||
registry.sireto.io/deltalender/delta-pdf-api:${{ github.sha }} | ||
|
@@ -56,15 +59,15 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Executing remote ssh commands using ssh key and deploying | ||
name: Update docker service over ssh | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SIRETO_BASTION_HOST }} | ||
username: githubci | ||
key: ${{ secrets.SIRETO_BASTION_SSH_KEY }} | ||
port: ${{ secrets.SIRETO_BASTION_PORT }} | ||
script: | | ||
if [ ${{ github.ref_type }} == 'master' ]; then | ||
if [ ${{ github.ref_name }} == 'master' ]; then | ||
docker --host=${{ secrets.PROD_DEPLOYMENT_HOST }} service update --image=registry.sireto.io/deltalender/delta-pdf-api:${{ github.ref_name }} delta_sign_api | ||
elif [ ${{ github.ref_name }} == 'develop' ]; then | ||
docker --host=${{ secrets.DEV_DEPLOYMENT_HOST }} service update --image=registry.sireto.io/deltalender/delta-pdf-api:${{ github.sha }} delta_sign_dev_api | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8 | ||
FROM python:3.8 | ||
RUN apt-get update && \ | ||
apt-get install -y swig && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY . /app | ||
COPY ./requirements.txt /app/requirements.txt | ||
RUN apt update && apt install -y swig | ||
|
||
# We create home folder for non-root user. | ||
RUN useradd -u 1001 -U -d /server -m app | ||
WORKDIR /server | ||
ENV PATH="$PATH:/server/.local/bin" | ||
USER app | ||
|
||
WORKDIR /app | ||
RUN pip3 install -r requirements.txt | ||
COPY ./requirements.txt ./requirements.txt | ||
|
||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] | ||
# install all the packages with cache disabled. (this layer will be cached unless requirements.txt is changed.) | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copy the code | ||
COPY ./ ./ | ||
|
||
EXPOSE 8000 | ||
CMD [ "uvicorn", "--proxy-headers", "--forwarded-allow-ips=*", "main:app", "--host", "0.0.0.0", "--port", "8000" ] |