mirror of
https://github.com/alexhopeoconnor/SunGather.git
synced 2026-10-24 03:12:33 +10:00
Merge pull request #66 from bohdan-s/feature/docker_build_action
adds github action to build and push docker image
This commit is contained in:
@@ -2,17 +2,32 @@ name: Docker Image CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches:
|
||||||
pull_request:
|
- main
|
||||||
branches: [ "main" ]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
docker:
|
||||||
build:
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
runs-on: python:3-slim
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Build the Docker image
|
- uses: actions/setup-python@v4
|
||||||
run: docker build . --file Dockerfile --tag sungather:$(date +%s)
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
-
|
||||||
|
run: echo "::set-output name=tag::v$(python setup.py --version)"
|
||||||
|
id: version
|
||||||
|
- uses: docker/setup-qemu-action@v1
|
||||||
|
- uses: docker/setup-buildx-action@v1
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
push: true
|
||||||
|
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/sungather:${{ steps.version.outputs.tag }},${{ secrets.DOCKERHUB_USERNAME }}/sungather:latest
|
||||||
|
|||||||
@@ -115,3 +115,7 @@ dmypy.json
|
|||||||
|
|
||||||
# Pyre type checker
|
# Pyre type checker
|
||||||
.pyre/
|
.pyre/
|
||||||
|
|
||||||
|
# Intellij IDEA
|
||||||
|
.idea
|
||||||
|
*.iml
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
FROM python:3-slim
|
FROM python:3-slim
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y build-essential python3-dev && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN useradd sungather
|
RUN useradd sungather
|
||||||
|
|
||||||
WORKDIR /usr/src/sungather
|
WORKDIR /usr/src/sungather
|
||||||
|
|||||||
Reference in New Issue
Block a user