Skip to content

Commit

Permalink
chore(ci): add build and publish to org_nossas
Browse files Browse the repository at this point in the history
  • Loading branch information
igr-santos committed Jul 15, 2024
1 parent 9459213 commit 49e1e73
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- main
tags:
- v*
paths-ignore:
- app/org_nossas/**


jobs:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/publish_org_nossas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish NOSSAS / CMS docker image
on:
push:
paths:
- 'app/contrib/**'
- 'app/project/**'
- 'app/tailwind/**'
- 'app/admin_styled/**'
- 'app/org_nossas/**'
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/nossas-cms

- name: Build and Push
uses: docker/build-push-action@v3
with:
context: ./app
file: Dockerfile.nossas
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
63 changes: 63 additions & 0 deletions Dockerfile.nossas
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_nossas/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_nossas/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
4 changes: 2 additions & 2 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ services:


nossas:
image: ${NOSSAS_DOCKER_IMAGE:-nossas/cms:latest}
image: ${NOSSAS_DOCKER_IMAGE:-nossas/nossas-cms:latest}
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
pull_policy: always
environment:
- DJANGO_SETTINGS_MODULE=nossas.settings.production
- DJANGO_SETTINGS_MODULE=org_nossas.settings.production
- DEBUG=${DEBUG:-True}
- ALLOWED_HOSTS=${ALLOWED_HOSTS:-"docker.localhost"}
- CMS_DATABASE_URL=${NOSSAS_DATABASE_URL}
Expand Down

0 comments on commit 49e1e73

Please sign in to comment.