Skip to content

Commit

Permalink
chore: push docker image to ghcr (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMissx authored May 19, 2023
1 parent 1532db3 commit 2511ee9
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 6 deletions.
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.git/
.cache/
.github/
.editorconfig

deepsrouce.toml
.pre-commit-config.yaml
*.md
*.log
LICENSE
Makefile

__pycache__/
test/
downloads/
58 changes: 58 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Docker

on:
push:
branches:
- topic-canary
# Publish semver tags as releases.
tags:
- "v*"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.USERBOTINDO_ACCESS_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
USERBOTINDO_ACCESS_TOKEN=${{ secrets.USERBOTINDO_ACCESS_TOKEN }}
5 changes: 0 additions & 5 deletions Aptfile

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Set base image (host OS)
FROM python:3.10-slim-bullseye AS base
FROM python:3.10-slim-bullseye

# Set the working directory in the container
WORKDIR /anjani/
Expand Down

0 comments on commit 2511ee9

Please sign in to comment.