Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ webapp/tmp/*
/_assets_src/*
/api-server/target/*
/.git
/.github
77 changes: 77 additions & 0 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# This workflow builds the docker image on any PR or Release
# Releases will be tagged with latest, stable, and their git tag
# Prereleases will be tagged with prerelease and their git tag
# Pull Requests will be tagged with branch name and their github ref (pr-{number})

name: Create and publish a Docker image

on:
release:
types: [published]

pull_request:
branches:
- '*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
RELEASE: ${{ github.event.release != null && github.event.release.prerelease != true }}
PRERELEASE: ${{ github.event.release != null && github.event.release.prerelease == true }}


jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.9"

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Fix versions
run: python scripts/github_version_fix.py

- name: Setup docker buildx
uses: docker/setup-buildx-action@v1
id: buildx
with:
install: true
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=${{ env.RELEASE }}
tags: |
type=ref, event=tag, enable=true
type=ref, event=branch, enable=true
type=ref, event=pr, enable=true
type=raw, value=prerelease, enable=${{ env.PRERELEASE }}
type=raw, value=stable, enable=${{ env.RELEASE }}
type=raw, value=${{ github.head_ref }}, enable=${{ github.event.pull_request != null}}

- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: docker/Dockerfile
push: ${{ github.event.release != null }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.6"
python-version: "3.9"
- run: pip install pipenv
- name: Check out repository code
uses: actions/checkout@v2
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Version 2.18.0

Moved Python to 3.9 and update the docker container to use Ubuntu 20.04


## Version 2.17.3

**NOTE**: the default `BACKSLASH_DATABASE_URI` has been changed in this release (in
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ tmuxp = "*"
yarl = "*"

[requires]
python_version = "3.6"
python_version = "3.9"

[scripts]
manage = "python manage.py"
Expand Down
769 changes: 448 additions & 321 deletions Pipfile.lock

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ ADD ./api-server /api-server
RUN sudo chown -R rust:rust /api-server
RUN cd /api-server && rm -rf target && cargo test --release && cargo build --release

FROM ubuntu:16.04
FROM ubuntu:20.04

env PYTHON_VERSION 3.6
env PYTHON_EXECUTABLE python$PYTHON_VERSION
ENV PYTHON_VERSION 3.9
ENV PYTHON_EXECUTABLE python$PYTHON_VERSION

env LC_ALL C.UTF-8
env LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN apt-get -y install build-essential software-properties-common libpq-dev nginx curl redis-server gcc sudo libsasl2-dev libldap2-dev wget git
Expand All @@ -34,7 +36,7 @@ RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/

RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update
RUN apt-get install -y $PYTHON_EXECUTABLE $PYTHON_EXECUTABLE-dev
RUN apt-get install -y $PYTHON_EXECUTABLE $PYTHON_EXECUTABLE-dev $PYTHON_EXECUTABLE-distutils

RUN wget https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py
RUN $PYTHON_EXECUTABLE /tmp/get-pip.py
Expand Down
27 changes: 27 additions & 0 deletions scripts/github_version_fix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os

if __name__ == "__main__":
github_ref_type = os.environ.get('GITHUB_REF_TYPE')
github_sha = os.environ.get("GITHUB_SHA")
github_ref_name = os.environ.get("GITHUB_REF_NAME")
github_event_name = os.environ.get("GITHUB_EVENT_NAME")
github_head_ref = os.environ.get("GITHUB_HEAD_REF")

if github_ref_type == "tag":
# Use tag for version if it exists
version = github_ref_name
elif github_event_name == "pull_request":
# For pull requests use the branch, short SHA and the ref (pr-#)
version = f"{github_head_ref}_{github_sha[:8]}_{github_ref_name}"
elif github_event_name != "pull_request" and github_ref_type == "branch":
# For pushes to branch use branch and short SHA
version = f"{github_ref_name}_{github_sha[:8]}"
else:
# For any other situations use the full SHA
version = github_sha

with open('flask_app/__version__.py', 'w') as f:
print(f'__version__ = "{version}"', file=f)

with open('webapp/app/utils/ui_version.js', 'w') as f:
print(f'export default "{version}";', file=f)