-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add Dockerfile to run application in container Added Dockerfile with .dockerignore to streamline use of enex2notion. User can now build an image with '$ docker build -t <image_name>:>tag> .' Data volume is declared at /data, which client can map to the host directory where the .enex files reside. Entrypoint already specifies the launch script, all left to do is to add CLI arguments. * docs(readme): add info about building docker images Added section with commands to build a docker image from the source as well as run it. * build: update Dockerfile * ci(github): add container release workflow * docs(readme): add info about docker * docs(readme): move docker info higher --------- Co-authored-by: vzhd1701 <vzhd1701@gmail.com>
- Loading branch information
Showing
3 changed files
with
123 additions
and
0 deletions.
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,78 @@ | ||
name: release_containers | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
jobs: | ||
release_ghcr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Checkout latest release tag | ||
if: github.event_name == 'workflow_dispatch' | ||
run: | | ||
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) | ||
git checkout $LATEST_TAG | ||
echo "TAG_VERSION=$LATEST_TAG" >> $GITHUB_ENV | ||
- name: Get push tag version | ||
if: github.event_name == 'push' | ||
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Publish Docker image to GitHub Container Registry | ||
uses: elgohr/Publish-Docker-Github-Action@v5 | ||
with: | ||
name: ${{ github.repository }} | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
tags: "latest,${{ env.TAG_VERSION }}" | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
release_docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Checkout latest release tag | ||
if: github.event_name == 'workflow_dispatch' | ||
run: | | ||
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) | ||
git checkout $LATEST_TAG | ||
echo "TAG_VERSION=$LATEST_TAG" >> $GITHUB_ENV | ||
- name: Get push tag version | ||
if: github.event_name == 'push' | ||
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Publish Docker image to Docker Container Registry | ||
uses: elgohr/Publish-Docker-Github-Action@v5 | ||
with: | ||
name: ${{ github.repository }} | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
tags: "latest,${{ env.TAG_VERSION }}" | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
- name: Update Docker Hub Description | ||
uses: peter-evans/dockerhub-description@v3 | ||
with: | ||
repository: ${{ github.repository }} | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} |
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,37 @@ | ||
FROM debian:12-slim AS build | ||
|
||
ENV BUILD_POETRY_VERSION=1.6.1 | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-suggests --no-install-recommends --yes python3-venv python3-pip && \ | ||
python3 -m venv /venv && \ | ||
/venv/bin/pip install --upgrade pip | ||
|
||
RUN pip3 install --break-system-packages poetry==$BUILD_POETRY_VERSION | ||
|
||
FROM build AS build-venv | ||
|
||
COPY . /app | ||
WORKDIR /app | ||
|
||
RUN poetry build --no-interaction -f wheel | ||
RUN /venv/bin/pip install --disable-pip-version-check dist/*.whl | ||
|
||
FROM gcr.io/distroless/python3-debian12 | ||
|
||
ENV INSIDE_DOCKER_CONTAINER=1 | ||
|
||
LABEL maintainer="vzhd1701 <vzhd1701@gmail.com>" \ | ||
org.opencontainers.image.title="enex2notion" \ | ||
org.opencontainers.image.description="Import Evernote ENEX files to Notion " \ | ||
org.opencontainers.image.authors="vzhd1701 <vzhd1701@gmail.com>" \ | ||
org.opencontainers.image.licenses="MIT" \ | ||
org.opencontainers.image.documentation="https://github.com/vzhd1701/enex2notion" \ | ||
org.opencontainers.image.url="https://github.com/vzhd1701/enex2notion" \ | ||
org.opencontainers.image.source="https://github.com/vzhd1701/enex2notion.git" | ||
|
||
COPY --from=build-venv /venv /venv | ||
|
||
WORKDIR /input | ||
|
||
ENTRYPOINT ["/venv/bin/enex2notion"] |
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