Skip to content

Commit e88ecc1

Browse files
authored
UK-1107: Update Debian to version 10 and add CIs (#8)
* UK-1107: Update Debian to version 10 and add CIs * Update Readme * Update Dockerfile * Update python-mecab-builder image
1 parent c0fa457 commit e88ecc1

File tree

3 files changed

+60
-25
lines changed

3 files changed

+60
-25
lines changed

.github/workflows/build-and-push.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- Dockerfile
7+
types:
8+
- opened # default
9+
- synchronize # default
10+
- reopened # default
11+
- ready_for_review # draft -> ready
12+
release:
13+
types: [published]
14+
15+
env:
16+
REGISTRY: ghcr.io/bebit
17+
IMAGE_NAME: "${{ github.event_name == 'release' && 'python-mecab' || 'python-mecab-dev' }}"
18+
19+
jobs:
20+
build-and-push-image:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
packages: write
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v3
28+
29+
- name: Log in to the Container registry
30+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata (tags, labels) for Docker
37+
id: meta
38+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
42+
- name: Build and push Docker image
43+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
44+
with:
45+
context: .
46+
push: true
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
FROM bebit/python-mecab-builder:release-2.0 as builder
1+
FROM ghcr.io/bebit/python-mecab-builder:3.0 as builder
22
RUN git clone --depth 1 https://github.com/neologd/mecab-ipadic-neologd.git && \
33
mecab-ipadic-neologd/bin/install-mecab-ipadic-neologd -y -n -p /var/lib/mecab/dic/mecab-ipadic-neologd
44

5-
FROM python:3.7-slim-stretch
5+
FROM python:3.7-slim-buster
66
RUN apt-get update > /dev/null && apt-get install -y --no-install-recommends \
7-
default-libmysqlclient-dev=1.0.2 \
8-
mecab=0.996-3.1 \
9-
mecab-ipadic-utf8=2.7.0-20070801+main-1 \
10-
libmecab-dev=0.996-3.1 \
11-
swig=3.0.10-1.1 > /dev/null \
7+
default-libmysqlclient-dev=1.0.5 \
8+
mecab=0.996-6 \
9+
mecab-ipadic-utf8=2.7.0-20070801+main-2.1 \
10+
libmecab-dev=0.996-6 \
11+
swig=3.0.12-2 > /dev/null \
1212
&& apt-get clean \
1313
&& rm -rf /var/lib/apt/lists/*
1414
RUN sed -i -r 's/^dicdir = .*$$/dicdir = \/var\/lib\/mecab\/dic\/mecab-ipadic-neologd/' /etc/mecabrc

README.md

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,8 @@
33
`Python 3.7` with `mecab` dependencies.
44

55
## How to use
6-
In your `DOCKERFILE` specify your image with a release build as its tag.
7-
8-
e.g. To use this image with the `release-1.1` build you would include something like below:
9-
```yml
10-
docker:
11-
- image: bebit/python-mecab:release-1.1
12-
```
13-
14-
## Updating image dependencies
15-
16-
E.g. If you wanted to change from `python 3.7.9` to `python 3.5.6` you would just update the image tag like below:
17-
18-
```diff
19-
- FROM python:3.7-slim-stretch
20-
+ FROM python:3.5-slim-stretch
21-
```
22-
23-
Then push your changes to a branch on the `beBit` repo and then your branch name is served as an image tag. e.g. Your branch name `python_mecab_python-3.5.6` will be written as `bebit/python-mecab:python_mecab_python-3.5.6` in your `DOCKERFILE`
6+
- Until 2.0 release, docker images are stored in https://hub.docker.com/r/bebit/python-mecab
7+
- Later releases are stored in Github Container Registry
8+
- Dev: https://github.com/orgs/bebit/packages/container/package/python-mecab-dev
9+
- Prod: https://github.com/orgs/bebit/packages/container/package/python-mecab
10+
- For the build and push workflow, refer to [build-and-push.yml](.github/workflows/build-and-push.yml)

0 commit comments

Comments
 (0)