-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
90 additions
and
1 deletion.
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,56 @@ | ||
name: Update gh docker image and triggers | ||
|
||
on: | ||
# Triggers the workflow on releases | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '*' | ||
pull_request: | ||
# Allow to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-image: | ||
name: Build docker image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Get the image id | ||
run: | | ||
IMAGE_ID=$(echo ghcr.io/${{ github.repository }} | tr '[A-Z]' '[a-z]') | ||
echo "IMAGE_ID=$IMAGE_ID" >> "$GITHUB_ENV" | ||
- name: Get the version PR | ||
run: echo "VERSION=${{ github.head_ref }}" >> "$GITHUB_ENV" | ||
if: github.event_name == 'pull_request' | ||
|
||
- name: Get the version | ||
run: echo "VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV" | ||
if: github.event_name != 'pull_request' | ||
|
||
- name: Build and push container image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.IMAGE_ID }}:${{ env.VERSION }} | ||
platforms: linux/amd64,linux/arm64 |
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,16 @@ | ||
FROM python:3.8 | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN apt-get update && \ | ||
pip install -r requirements.txt && \ | ||
buildout -N -c docker.cfg && \ | ||
sed -i 's/bind 127.0.0.1 ::1/bind 0.0.0.0/g' ./etc/redis.conf | ||
|
||
EXPOSE 4000/tcp | ||
|
||
HEALTHCHECK --interval=30s --timeout=3s CMD curl --fail http://localhost:4020/ || exit 1 | ||
|
||
ENTRYPOINT ["bin/supervisord", "-n"] |
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,17 @@ | ||
[buildout] | ||
extends = | ||
production.cfg | ||
|
||
# parts -= | ||
# ${redis:parts} | ||
|
||
[supervisor] | ||
recipe = collective.recipe.supervisor | ||
http-socket = unix | ||
user = admin | ||
password = admin | ||
file = ${buildout:directory}/var/supervisor.sock | ||
programs = | ||
100 dispatcher ${buildout:directory}/bin/gunicorn [-w 4 -b 0.0.0.0:${ports:gunicorn} production:app] ${buildout:directory} true | ||
200 redis (killasgroup=true stopasgroup=true) ${buildout:directory}/bin/redis-server true | ||
300 rq ${buildout:directory}/bin/rq [worker --url redis://127.0.0.1:${ports:redis}] ${buildout:directory} true |
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