Skip to content

Commit

Permalink
Merge pull request #7 from Angel-Dijoux/angel/hostfix-add-dockerfile
Browse files Browse the repository at this point in the history
[HOSTFIX] Re-add `Dockerfile` in code
  • Loading branch information
Angel-Dijoux authored Jul 2, 2023
2 parents 0cb61f8 + d8c0d4c commit 55c6379
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Deployment

on: [push]
on:
push:
branches:
- main

env:
MARIADB_ROOT_PASSWORD: ${{ secrets.MARIADB_ROOT_PASSWORD }}
Expand All @@ -15,11 +18,11 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
# - name: Stop running Docker container
# run: docker stop api
# - name: remove container
# run: docker rm api
# - name: Remove previous Docker image
# run: docker rmi onisep_api-api:latest
- name: Stop running Docker container
run: docker stop api
- name: remove container
run: docker rm api
- name: Remove previous Docker image
run: docker rmi onisep_api-api:latest
- name: Build and Run Docker container
run: docker-compose up -d
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ __pycache__/
#Ignore variable env
.flaskenv
.dockerignore
Dockerfile
.env

#Ignore db local file
Expand Down
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM python:slim-buster AS build
ENV PYTHONUNBUFFERED 1

LABEL authors="Angel-Dijoux"

WORKDIR /app

ENV ENV=production
ENV FLASK_APP=src


COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

EXPOSE 5005

CMD ["gunicorn", "run:app" ,"-c" ,"gunicorn.conf.py" ]
2 changes: 0 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ if [ ! -d "/app/migrations" ]; then
echo "Init database"
flask db init
fi
echo "Run migration"
flask db migrate -m 'create initial tables'
echo "Upgrade tables"
flask db upgrade
echo "Finish"
Expand Down

0 comments on commit 55c6379

Please sign in to comment.