Skip to content

Commit

Permalink
Add testing image for pseudo-Drupal and workflow to buil dit
Browse files Browse the repository at this point in the history
  • Loading branch information
nutjob4life committed Jan 8, 2025
1 parent 3efe102 commit b3e686e
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/drupal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Drupal Image
# ============
#
# This workflow builds and registers an image of Apache HTTP with Drupal and the Web Strategy
# Team's customizations to Drupal in order to support the Planetary Data System's portal.

---

name: 🥀 Drupal Image


# Triggers
# --------
#
# Run on any push to the Drupal subdirectory, or via another workflow via the
# `workflow_dispatch` trigger.

on:
push:
branches:
- main
- develop
paths:
- 'drupal/**'
workflow_dispatch:


# Jobs
# ----
#
# What to do.

jobs:
solr-image:
name: 🥀 Drupal Image
runs-on: ubuntu-latest
steps:
-
name: 📚 Repository Checkout
uses: actions/checkout@v3
with:
submodules: true
token: ${{secrets.WEB_STRATEGY_TEAM_PAT}}
fetch-depth: 0
-
name: 🏞️ AWS Identification
uses: aws-actions/configure-aws-credentials@v3
with:
aws-access-key-id: ${{secrets.AWS_ACCESS_KEY_ID}}
aws-secret-access-key: ${{secrets.AWS_SECRET_ACCESS_KEY}}
aws-region: us-west-2
-
name: 🪪 ECR Identification
uses: docker/login-action@v2
with:
registry: ${{secrets.AWS_ACCOUNT_ID}}.dkr.ecr.us-west-2.amazonaws.com
-
name: 🎰 QEMU Multiple Machine Emulation
uses: docker/setup-qemu-action@v2
-
name: 🚢 Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: 🧱 Image Construction and Publication
uses: docker/build-push-action@v5
with:
context: .
file: drupal/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{secrets.AWS_ACCOUNT_ID}}.dkr.ecr.us-west-2.amazonaws.com/solr-portal:latest

...

# -*- mode: YAML; tab-width: 4 -*-
18 changes: 18 additions & 0 deletions drupal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Drupal Dockerfile
# =================
#
# Okay, this obviously is not Apache HTTPD with Drupal. This is testing the EC2→ECS transition
# and intra-VPC communication.

FROM python:3.9-slim

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

WORKDIR /app

RUN pip install flask requests
COPY drupal/app.py /app/
EXPOSE 8080

CMD ["python", "app.py"]
25 changes: 25 additions & 0 deletions drupal/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from flask import Flask, Response
import requests

app = Flask(__name__)


@app.route('/')
def index():
return Response('<p>Okay, this from Flask, 🌍</p>', mimetype='text/html')
# solr_url = 'http://solr.drupalservices.local:8983/solr/'

# try:
# response = requests.get(solr_url)
# if response.status_code == 200:
# solr_status = '<pre>Solr OK</pre>'
# else:
# solr_status = '<pre>Solr NOT OK</pre>'
# except Exception as e:
# solr_status = f'<pre>Error: {e}</pre>'

# return Response(f"{solr_status}<p>That's it</p>", mimetype='text/html')


if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)

0 comments on commit b3e686e

Please sign in to comment.