Skip to content

Commit

Permalink
Merge pull request #2 from sireto/master
Browse files Browse the repository at this point in the history
merge master to develop
  • Loading branch information
kneerose authored Aug 3, 2023
2 parents 0eee502 + 0509c5e commit dcaa9fa
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand All @@ -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
Expand Down
27 changes: 20 additions & 7 deletions delta-pdf-api/Dockerfile
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" ]

0 comments on commit dcaa9fa

Please sign in to comment.