-
-
Notifications
You must be signed in to change notification settings - Fork 34
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 #222 from code4romania/develop
Prod push
- Loading branch information
Showing
61 changed files
with
1,395 additions
and
762 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
POSTGRES_USER=postgres | ||
POSTGRES_PASSWORD=postgres | ||
POSTGRES_DB=catpol | ||
|
||
DATABASE_URL=postgres://postgres:postgres@db/catpol |
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence, | ||
# they will be requested for review when someone | ||
# opens a pull request. | ||
* @catileptic | ||
|
||
# More details on creating a codeowners file: | ||
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Build and push to Dockerhub | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Build the Docker image | ||
if: github.ref == 'refs/heads/develop' | ||
run: | | ||
docker build . \ | ||
--file ./Dockerfile \ | ||
--tag ${{ secrets.DOCKER_HUB_ORGANIZATION }}/${{ secrets.DOCKER_HUB_REPOSITORY }}:latest | ||
- name: Login to docker registry | ||
if: github.ref == 'refs/heads/develop' | ||
run: docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} -p ${{ secrets.DOCKER_HUB_PASSWORD }} | ||
|
||
- name: Push to docker registry | ||
if: github.ref == 'refs/heads/develop' | ||
run: docker push ${{ secrets.DOCKER_HUB_ORGANIZATION }}/${{ secrets.DOCKER_HUB_REPOSITORY }}:latest |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
container: alexstefanescu/catpol-dependencies | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements-dev.txt | ||
- name: Check formatting with black | ||
run: | | ||
black --line-length 120 --target-version py37 --check . | ||
- name: Run tests | ||
env: | ||
DJANGO_SETTINGS_MODULE: project_template.settings.dev | ||
run: pytest project_template |
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,15 +1,18 @@ | ||
FROM alexstefanescu/catpol-dependencies | ||
|
||
RUN pip3 install --upgrade pip setuptools | ||
RUN pip3 install --upgrade pip setuptools \ | ||
&& wget -qO- https://github.com/jwilder/dockerize/releases/download/v0.2.0/dockerize-linux-amd64-v0.2.0.tar.gz | tar -zxf - -C /usr/bin \ | ||
&& chown root:root /usr/bin/dockerize | ||
|
||
ARG ENVIRONMENT=dev | ||
ENV DJANGO_SETTINGS_MODULE=project_template.settings.${ENVIRONMENT} | ||
|
||
# RUN find -type d -name __pycache__ -prune -exec rm -rf {} \; && \ | ||
# rm -rf ~/.cache/pip | ||
COPY ./ /opt/catpol | ||
|
||
# Re-install dependencies since it might have updated from cache | ||
RUN pip3 install -r requirements-${ENVIRONMENT}.txt | ||
|
||
COPY . /opt/catpol | ||
RUN python3 manage.py check | ||
CMD python3 manage.py migrate --run-syncdb \ | ||
&& python3 manage.py runserver 0.0.0.0:8000 | ||
|
||
ENTRYPOINT ["/opt/catpol/docker-entrypoint"] | ||
EXPOSE 8000 |
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
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
This file was deleted.
Oops, something went wrong.
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,19 +1,21 @@ | ||
version: '3' | ||
services: | ||
catpol-database: | ||
web: | ||
build: . | ||
command: dockerize -wait tcp://db:5432 -timeout 90s | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- ./:/opt/catpol | ||
|
||
db: | ||
image: "postgres:12" | ||
container_name: catpol_psql | ||
ports: | ||
- "5432:5432" | ||
env_file: | ||
- database.env | ||
- .env | ||
volumes: | ||
- database-data:/var/lib/postgresql/data/ | ||
catpol: | ||
build: . | ||
container_name: catpol | ||
ports: | ||
- "8000:8000" | ||
- database-data:/var/lib/postgresql/data/ | ||
|
||
volumes: | ||
database-data: | ||
database-data: |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
PORT=${PORT:-"8000"} | ||
|
||
echo "Migrating databse" | ||
python3 manage.py migrate --run-syncdb | ||
|
||
echo "Seed" | ||
python3 manage.py seed | ||
|
||
echo "Start web server on $PORT" | ||
python3 manage.py runserver "0.0.0.0:$PORT" |
Binary file not shown.
Oops, something went wrong.