Skip to content

Commit 4ee3a76

Browse files
committed
Simod HTTP docker image scripts and CI/CD workflow setup
1 parent aea8eb7 commit 4ee3a76

File tree

4 files changed

+78
-3
lines changed

4 files changed

+78
-3
lines changed

.github/workflows/simod_http.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Simod HTTP
2+
3+
on:
4+
workflow_run:
5+
workflows: [ "Simod" ]
6+
types:
7+
- completed
8+
9+
env:
10+
DOCKERHUB_USERNAME: nokal
11+
DOCKERHUB_REPO: nokal/simod_http
12+
13+
jobs:
14+
on-success:
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 15
17+
outputs:
18+
version: ${{ steps.versioning.outputs.version }}
19+
docker_image: ${{ env.DOCKERHUB_REPO }}:${{ steps.versioning.outputs.version }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Compose a version
27+
id: versioning
28+
uses: paulhatch/semantic-version@v4.0.2
29+
with:
30+
tag_prefix: "v"
31+
major_pattern: "BREAKING CHANGE:"
32+
minor_pattern: "feat:"
33+
format: "${major}.${minor}.${patch}-prerelease${increment}"
34+
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v1
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v1
40+
41+
- name: Login to DockerHub
42+
uses: docker/login-action@v1
43+
with:
44+
username: ${{ env.DOCKERHUB_USERNAME }}
45+
password: ${{ secrets.DOCKERHUB_TOKEN }}
46+
47+
- name: Build and push to DockerHub
48+
uses: docker/build-push-action@v2
49+
with:
50+
push: true
51+
tags: ${{ env.DOCKERHUB_REPO }}:latest,${{ env.DOCKERHUB_REPO }}:${{ steps.versioning.outputs.version }}
52+
file: docker/simod_build.dockerfile
53+
context: docker/
54+
platforms: linux/amd64,linux/arm64
55+
56+
- name: Create a release
57+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
58+
uses: actions/create-release@v1
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
61+
with:
62+
tag_name: ${{ steps.versioning.outputs.version }}
63+
release_name: ${{ steps.versioning.outputs.version }}
64+
prerelease: true

.java-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.8

docker/simod_http.dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ RUN bash build_from_git.bash
1313

1414
ENV DISPLAY=:99
1515
ENV SIMOD_HTTP_DEBUG=false
16-
ENV VIRTUAL_ENV=/usr/src/simod/venv
16+
ENV VIRTUAL_ENV=/usr/src/Simod/venv
1717

18-
WORKDIR /usr/src/Simod/src/simod_http
18+
WORKDIR /usr/src/Simod/
19+
ADD simod_http_run.bash .
1920

20-
CMD ["/usr/src/Simod/venv/bin/uvicorn", "simod_http.main:app", "--host", "0.0.0.0", "--port", "80"]
21+
CMD ["/bin/bash", "simod_http_run.bash"]

docker/simod_http_run.bash

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
Xvfb :99 &>/dev/null & disown
4+
5+
cd /usr/src/Simod
6+
source venv/bin/activate
7+
8+
cd /usr/src/Simod/src/simod_http
9+
uvicorn simod_http.main:app --host 0.0.0.0 --port 80

0 commit comments

Comments
 (0)