Skip to content

Commit

Permalink
Merge pull request #40 from jphacks/feature/faster_docker_with_actions
Browse files Browse the repository at this point in the history
Feature/faster docker with actions
  • Loading branch information
sanosuke216 authored Nov 13, 2023
2 parents 4088c14 + 0dbf16f commit 4fa00d1
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build_base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Docker Master Build

on:
workflow_dispatch:
push:
branches:
- master
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}_base

jobs:
build-and-push:
runs-on: ubuntu-20.04

permissions:
contents: read
packages: write

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

- name: get_version
id: build_version
run: |
file_path="pyproject.toml"
version=$(awk -F ' = ' '$1=="version" {gsub(/"/, "", $2); print $2}' "$file_path")
echo "VERSION=$version" >> $GITHUB_OUTPUT
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3

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

- name: Build Base image
uses: docker/build-push-action@v5
with:
context: .
file: ./deploy/Dockerfile
push: true
# platforms: linux/amd64,linux/arm64
tags: |
${{ env.REGISTRY }}/jphacks/kb_2315/base:master
3 changes: 1 addition & 2 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python:3.11-slim

COPY ../. /src
WORKDIR /src
COPY ../requirements.lock ../pyproject.toml ../README.md /src/

ARG UID=1000
ARG GID=1000
Expand All @@ -11,4 +11,3 @@ RUN groupadd -g $GID dev && \
pip install -r requirements.lock --no-cache-dir

USER dev
CMD ["python", "./src/main.py"]

0 comments on commit 4fa00d1

Please sign in to comment.