Skip to content

Commit

Permalink
chore(ci): reorganize deploys to others site projects
Browse files Browse the repository at this point in the history
  • Loading branch information
igr-santos committed Jul 15, 2024
1 parent 49e1e73 commit 7353430
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 77 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/pubish_org_eleicoes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Eleições / CMS docker image
on:
push:
paths:
- 'app/contrib/**'
- 'app/project/**'
- 'app/tailwind/**'
- 'app/admin_styled/**'
- 'app/org_eleicoes/**'
branches:
- main
- 'releases/**'
- 'feature/**'
- 'hotfix/**'
tags:
- v*

jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: nossas/eleicoes-cms

- name: Build and Push
uses: docker/build-push-action@v3
with:
context: ./app
file: Dockerfile.eleicoes
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
47 changes: 47 additions & 0 deletions .github/workflows/publish_org_amazonia_de_pe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Eleições / CMS docker image
on:
push:
paths:
- 'app/contrib/**'
- 'app/project/**'
- 'app/tailwind/**'
- 'app/admin_styled/**'
- 'app/org_amazonia_de_pe/**'
branches:
- main
- 'releases/**'
- 'feature/**'
- 'hotfix/**'
tags:
- v*

jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: nossas/amazoniadepe-cms

- name: Build and Push
uses: docker/build-push-action@v3
with:
context: ./app
file: Dockerfile.amazoniadepe
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
63 changes: 63 additions & 0 deletions Dockerfile.amazoniadepe
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Build staticfiles
FROM node:18-alpine AS node-builder

WORKDIR /app

COPY . .

WORKDIR /app/tailwind

RUN npm i

RUN npm run page:build

RUN npm run admin:build

# Use an official Python runtime based on Debian 10 "buster" as a parent image.
FROM python:slim-buster

# Port used by this container to serve HTTP.
EXPOSE 8000

# Set environment variables.
# 1. Force Python stdout and stderr streams to be unbuffered.
# 2. Set PORT variable that is used by Gunicorn. This should match "EXPOSE"
# command.
ENV PYTHONUNBUFFERED=1 \
PORT=8000

# Install system packages required by Django CMS and Django.
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
build-essential \
cargo \
libssl-dev \
libffi-dev \
sox \
ffmpeg \
libcairo2 \
libcairo2-dev \
python3-dev \
git \
&& rm -rf /var/lib/apt/lists/*

# Install the application server.
RUN pip install uwsgi django-storages boto3 django-prometheus

# Install the project requirements.
COPY org_amazonia_de_pe/requirements.txt /
RUN pip install -r requirements.txt

# Use /app folder as a directory where the source code is stored.
WORKDIR /app

# Copy the source code of the project into the container.
COPY --from=node-builder /app ./

RUN python manage.py collectstatic --noinput --clear -i tailwindcss

# Runtime command that executes when "docker run" is called.

# Check traefik + etcd configs to running domains
ENV ENABLE_CHECK_TRAEFIK=True

CMD ["uwsgi", "--ini", "/app/wsgi.ini"]
63 changes: 63 additions & 0 deletions Dockerfile.eleicoes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Build staticfiles
FROM node:18-alpine AS node-builder

WORKDIR /app

COPY . .

WORKDIR /app/tailwind

RUN npm i

RUN npm run page:build

RUN npm run admin:build

# Use an official Python runtime based on Debian 10 "buster" as a parent image.
FROM python:slim-buster

# Port used by this container to serve HTTP.
EXPOSE 8000

# Set environment variables.
# 1. Force Python stdout and stderr streams to be unbuffered.
# 2. Set PORT variable that is used by Gunicorn. This should match "EXPOSE"
# command.
ENV PYTHONUNBUFFERED=1 \
PORT=8000

# Install system packages required by Django CMS and Django.
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
build-essential \
cargo \
libssl-dev \
libffi-dev \
sox \
ffmpeg \
libcairo2 \
libcairo2-dev \
python3-dev \
git \
&& rm -rf /var/lib/apt/lists/*

# Install the application server.
RUN pip install uwsgi django-storages boto3 django-prometheus

# Install the project requirements.
COPY org_eleicoes/requirements.txt /
RUN pip install -r requirements.txt

# Use /app folder as a directory where the source code is stored.
WORKDIR /app

# Copy the source code of the project into the container.
COPY --from=node-builder /app ./

RUN python manage.py collectstatic --noinput --clear -i tailwindcss

# Runtime command that executes when "docker run" is called.

# Check traefik + etcd configs to running domains
ENV ENABLE_CHECK_TRAEFIK=True

CMD ["uwsgi", "--ini", "/app/wsgi.ini"]
45 changes: 45 additions & 0 deletions app/org_amazonia_de_pe/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
django==4.2
django-environ
psycopg2-binary
django-select2
django-compressor==4.4
django-sass-processor==1.4
django-entangled==0.5.4
django-formtools
django-recaptcha==3
django-jsonform>=2.21.2
django-libsass==0.9
django-colorfield
django-tag-fields
django-admin-sortable2==2.1.10
# Django CMS
django-cms==3.11.5
djangocms-admin-style==3.2.4
djangocms-text-ckeditor
djangocms-picture
djangocms-video
djangocms_snippet
djangocms-frontend>=1.2.1
django-prometheus
# Authentication all platforms
# django-allauth
bcrypt
whitenoise
svglib
reportlab
django-social-share
pyjwt
requests
# Domains
etcd3-py>=0.1.6
dnspython>=2.4.2
# Nossas
django-haystack==3.2.1
django-translated-fields>=0.12.0
git+https://github.com/nossas/djangocms-form-builder.git@feature/add-input-fields-on-form-plugin
# Tests
pytest
pytest-django
pytest-cov
pytest-mock
mock
1 change: 1 addition & 0 deletions app/org_eleicoes/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-r ../requirements.txt
46 changes: 1 addition & 45 deletions app/org_nossas/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1 @@
django==4.2
django-environ
psycopg2-binary
django-select2
django-compressor==4.4
django-sass-processor==1.4
django-entangled==0.5.4
django-formtools
django-recaptcha==3
django-jsonform>=2.21.2
django-libsass==0.9
django-colorfield
django-tag-fields
django-admin-sortable2==2.1.10
# Django CMS
django-cms==3.11.5
djangocms-admin-style==3.2.4
djangocms-text-ckeditor
djangocms-picture
djangocms-video
djangocms_snippet
djangocms-frontend>=1.2.1
django-prometheus
# Authentication all platforms
# django-allauth
bcrypt
whitenoise
svglib
reportlab
django-social-share
pyjwt
requests
# Domains
etcd3-py>=0.1.6
dnspython>=2.4.2
# Nossas
django-haystack==3.2.1
django-translated-fields>=0.12.0
git+https://github.com/nossas/djangocms-form-builder.git@feature/add-input-fields-on-form-plugin
# Tests
pytest
pytest-django
pytest-cov
pytest-mock
mock
-r ../requirements.txt
Loading

0 comments on commit 7353430

Please sign in to comment.