Skip to content

Commit

Permalink
Refactor and update container builds
Browse files Browse the repository at this point in the history
- Build and run test suites using docker compose
- Create and publish a Docker image
- Remove TravisCI
- Move Dockerfile to root and update to use AlmaLinux 8
- Update bower deps to latest
- flake8 fixes
- Refactor and update composer config
- Deploy using gunicorn
- Update requirements.txt to latest that support python2
- Create entrypoint.sh script to unify how the container is deployed

Signed-off-by: Lance Albertson <[email protected]>
  • Loading branch information
ramereth committed Apr 5, 2024
1 parent 115bcb7 commit 5ed619b
Show file tree
Hide file tree
Showing 20 changed files with 320 additions and 261 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Build and run tests
on: [push]
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build container
run: |
mkdir media
cp env.dist .env
echo STREAMWEBS_TEST=1 >> .env
cp streamwebs_frontend/streamwebs_frontend/settings.py.dist streamwebs_frontend/streamwebs_frontend/settings.py
docker compose build
- name: Start Postgresql
run: |
docker compose up -d postgres_host
- name: Run tests
run: |
docker compose up web
41 changes: 41 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Create and publish a Docker image

on:
push:
branches:
- master
- develop
pull_request:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ streamwebs_frontend/media/
streamwebs_frontend/staticfiles/
# NFS write temps
.nfs*
Dockerfile.env
.env
docs/build
*.swp
*.sql
csvs/test_users.csv
sw_data/
streamwebs_frontend/streamwebs_frontend/settings.py
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM almalinux:8

RUN dnf -y install epel-release
RUN dnf config-manager --set-enabled powertools
RUN dnf -y install proj postgresql postgresql-devel nodejs npm wget \
freetype-devel libjpeg-devel libpng-devel python2-pip python2-devel gcc git \
gdal-devel gcc-c++
RUN ln -s /usr/bin/python2 /usr/bin/python

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app

RUN npm install -g bower
RUN bower install --allow-root
RUN pip2 install -r requirements.txt
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "streamwebs",
"dependencies": {
"jquery": "^2.2.3",
"d3": "4.2.1",
"materialize": "^0.97.7"
"jquery": "^3.7.1",
"d3": "5.16.0",
"materialize": "^1.0.0"
}
}
File renamed without changes.
Loading

0 comments on commit 5ed619b

Please sign in to comment.