Skip to content

Commit

Permalink
Merge branch 'split_image' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
scossu committed May 6, 2024
2 parents 9da41d9 + 29d5309 commit 15e32bd
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 46 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/push-app-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Push app image
on:
# This runs on v *.*.0 after the base image has been
# built and pushed, or on v
push:
tags:
- "v*.*.[1-9]*"
workflow_run:
workflows: ["Push base image"]
types: ["completed"]

env:
DOCKER_USER: lcnetdev
DOCKER_PASSWORD: ${{secrets.DOCKER_HUB}}
REPO_NAME: scriptshifter

jobs:
push-image-to-docker-hub:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
with:
submodules: recursive

- name: Build the Docker image
run: >
docker build -f Dockerfile .
--tag $DOCKER_USER/$REPO_NAME:${{ github.ref_name }}
--tag $DOCKER_USER/$REPO_NAME:latest
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: lcnetdev
password: ${{ secrets.DOCKER_HUB }}

- name: Push to Docker Hub
run: docker push $DOCKER_USER/$REPO_NAME --all-tags
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Push image to Docker Hub.
name: Push base image
on:
push:
tags:
- "v*.*.*"
- "v*.*.0"

env:
DOCKER_USER: lcnetdev
DOCKER_PASSWORD: ${{secrets.DOCKER_HUB}}
REPO_NAME: scriptshifter
REPO_NAME: scriptshifter-base

jobs:
push-image-to-docker-hub:
Expand All @@ -32,7 +32,8 @@ jobs:

- name: Build the Docker image
run: >
docker build . --tag $DOCKER_USER/$REPO_NAME:${{ github.ref_name }}
docker build -f scriptshifter_base.Dockerfile .
--tag $DOCKER_USER/$REPO_NAME:${{ github.ref_name }}
--tag $DOCKER_USER/$REPO_NAME:latest
- name: Login to Docker Hub
Expand Down
19 changes: 5 additions & 14 deletions .github/workflows/push-test-image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Push test image to Docker Hub.
name: Push test image
on:
push:
branch:
Expand All @@ -18,20 +18,11 @@ jobs:
with:
submodules: recursive

- name: checkout yiddish submodules (1/2)
uses: actions/checkout@v4
with:
repository: ibleaman/loshn-koydesh-pronunciation
path: ext/yiddish/yiddish/submodules/loshn-koydesh-pronunciation

- name: checkout yiddish submodules (2/2)
uses: actions/checkout@v4
with:
repository: ibleaman/hasidify_lexicon
path: ext/yiddish/yiddish/submodules/hasidify_lexicon

- name: Build the Docker image
run: docker build . --tag $DOCKER_USER/$REPO_NAME:test
run: >
docker build -f Dockerfile .
--tag $DOCKER_USER/$REPO_NAME:${{ github.ref_name }}
--tag $DOCKER_USER/$REPO_NAME:test
- name: Login to Docker Hub
uses: docker/login-action@v3
Expand Down
24 changes: 5 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
FROM python:3.10-slim-bookworm
FROM lcnetdev/scriptshifter-base:latest
ARG WORKROOT "/usr/local/scriptshifter/src"

RUN apt update
RUN apt install -y build-essential tzdata gfortran libopenblas-dev libboost-all-dev libpcre2-dev

ENV TZ=America/New_York
ENV _workroot "/usr/local/scriptshifter/src"

RUN addgroup --system www
RUN adduser --system www
RUN gpasswd -a www www

WORKDIR ${_workroot}
# Copy core application files.
WORKDIR ${WORKROOT}
COPY entrypoint.sh uwsgi.ini wsgi.py ./
COPY ext ./ext/
COPY scriptshifter ./scriptshifter/

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

# Remove development packages.
RUN apt remove -y build-essential git
RUN apt autoremove -y

RUN chmod +x ./entrypoint.sh
RUN chown -R www:www ${_workroot} .
#RUN chown -R www:www ${WORKROOT} .

EXPOSE 8000

Expand Down
7 changes: 7 additions & 0 deletions deps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# External dependencies.
aksharamukha>=2.1,<3
camel-tools>=1.5
funcy>=1.15,<2
pymarc>=4.0,<5
repackage>=0.7.3
./ext/yiddish
7 changes: 1 addition & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
aksharamukha>=2.1,<3
camel-tools>=1.5
# Core application dependencies.
flask>=2.3,<3
funcy>=1.15,<2
pymarc>=4.0,<5
python-dotenv>=1.0,<2
pyyaml>=6.0,<7
repackage>=0.7.3
uwsgi>=2.0,<2.1
./ext/yiddish
4 changes: 1 addition & 3 deletions scriptshifter/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ def transliterate_req():
except (NotImplementedError, ValueError) as e:
return (str(e), 400)

return {
"output": out, "warnings": warnings,
"debug": {"form_data": request.form}}
return {"output": out, "warnings": warnings}


@app.route("/feedback", methods=["POST"])
Expand Down
21 changes: 21 additions & 0 deletions scriptshifter_base.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.10-slim-bookworm

RUN apt update
RUN apt install -y build-essential tzdata gfortran libopenblas-dev libboost-all-dev libpcre2-dev

ENV TZ=America/New_York
ARG WORKROOT "/usr/local/scriptshifter/src"

RUN addgroup --system www
RUN adduser --system www
RUN gpasswd -a www www

# Copy external dependencies.
WORKDIR ${WORKROOT}
COPY ext ./ext/
COPY deps.txt ./
RUN pip install --no-cache-dir -r deps.txt

# Remove development packages.
RUN apt remove -y build-essential git
RUN apt autoremove -y
7 changes: 7 additions & 0 deletions test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM python:3.10-slim-bookworm

RUN apt update
RUN apt install -y build-essential libpcre2-dev

RUN pip install uwsgi

0 comments on commit 15e32bd

Please sign in to comment.