-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add testing image for pseudo-Drupal and workflow to buil dit
- Loading branch information
1 parent
3efe102
commit b3e686e
Showing
3 changed files
with
118 additions
and
0 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,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 -*- |
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,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"] |
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 @@ | ||
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) |