Skip to content

Commit

Permalink
docker, here we come
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewdeanmartin committed Jan 21, 2023
1 parent e581fbc commit 72e9bcd
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/build_push_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Docker image

on:
release:
types: [published]

jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
environment: DEV
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
# my-docker-hub-namespace/my-docker-hub-repository
images: |
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
file: docker/Dockerfile
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
File renamed without changes.
1 change: 1 addition & 0 deletions dedlin/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# when type checking dependents, tell type checkers to use this package's types
10 changes: 10 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.11.1-slim-buster
WORKDIR /app
ENV PIP_NO_CACHE_DIR=off
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=utf-8
ENV PATH="/root/.local/bin:${PATH}"
RUN python -m pip install --no-cache-dir --upgrade pip --quiet && \
python -m pip install --user pipx && python -m pipx ensurepath && \
pipx install "dedlin>=1.12.0"
ENTRYPOINT ["dedlin"]
18 changes: 18 additions & 0 deletions docker/Dockerfile_local
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3.11.1-slim-buster
WORKDIR /app
ENV PIP_NO_CACHE_DIR=off
ENV PYTHONUNBUFFERED=1
# multidict doesnt have pre-compiled things for many OSs
ENV MULTIDICT_NO_EXTENSIONS=1
# RUN apk add --no-cache linux-headers==4.19.36-r0 wget
ENV PATH="/root/.local/bin:${PATH}"
RUN python -m pip install --user pipx && python -m pipx ensurepath
# RUN python3 -m pipx ensurepath
# isort depends on pylint
RUN pipx install isort && \
pipx install pylint
RUN python -m pip install --no-cache-dir --upgrade pip --quiet \
&& pip install pipenv --no-cache-dir --quiet
COPY dist/so_pip-*-py3-none-any.whl /app/
RUN pipenv install so_pip-*.whl --skip-lock
ENTRYPOINT ["pipenv", "run", "so_pip"]
3 changes: 3 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd ..
docker build -t so_pip -f docker/Dockerfile .
cd docker
7 changes: 7 additions & 0 deletions docker/docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# If you you gitbash, to use tflint, etc docker version, you need this.
(
export MSYS_NO_PATHCONV=1
"docker.exe" "$@"
)
File renamed without changes.
7 changes: 7 additions & 0 deletions docker/dockerw.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# If you you gitbash, to use tflint, etc docker version, you need this.
(
export MSYS_NO_PATHCONV=1
"winpty" "docker.exe" "$@"
)
2 changes: 2 additions & 0 deletions docker/login.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
. ../.env
./dockerw.sh login --username=matthewdeanmartin --password "$DOCKER_PASSWORD"
1 change: 1 addition & 0 deletions docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./docker.sh run --rm -i -v "$PWD/data:/data" so_pip:latest "$@"
1 change: 1 addition & 0 deletions docker/run_debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./dockerw.sh run --rm -it -v "$PWD/data:/data" --entrypoint "bash" so_pip:latest

0 comments on commit 72e9bcd

Please sign in to comment.