Skip to content

Commit

Permalink
Dockerfile, build-docker-image.yml - remove stage 'app-base'
Browse files Browse the repository at this point in the history
  • Loading branch information
sssomeshhh committed Nov 8, 2022
1 parent 00d53fe commit 33f900c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 57 deletions.
43 changes: 1 addition & 42 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,6 @@ name: build-docker-image
on: [push, workflow_dispatch]

jobs:
build-base:
runs-on: ubuntu-latest
steps:
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ksssomesh12
password: ${{ secrets.GH_PACKAGES_TOKEN }}

- name: Setup Docker Buildx
id: setup_buildx
uses: docker/[email protected]

- name: Cache Docker Layers
id: cache_docker_layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-tgmb-base-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-tgmb-base-

- name: Build-Push Docker Image
id: docker_build_push
uses: docker/[email protected]
with:
builder: ${{ steps.setup_buildx.outputs.name }}
target: base
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
push: true
tags: ghcr.io/ksssomesh12/tgmb-beta:base

- name: Docker Image Digest
run: echo ${{ steps.docker_build_push.outputs.digest }}

- name: Move Docker Layer Cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
build-api:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -128,7 +87,7 @@ jobs:
build-app:
runs-on: ubuntu-latest
needs: [build-base, build-api, build-sdk]
needs: [build-api, build-sdk]
steps:
- name: Login to GitHub Container Registry
uses: docker/[email protected]
Expand Down
21 changes: 6 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
FROM ubuntu:jammy as base
ENV DEBIAN_FRONTEND='noninteractive'
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y aria2 curl ffmpeg jq locales nano pv python3 python3-pip python3-lxml tzdata && \
apt-get install -y libc++-dev libmagic-dev && \
rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8

FROM ubuntu:jammy as api
ENV DEBIAN_FRONTEND='noninteractive'
RUN apt-get update && apt-get upgrade -y && \
Expand Down Expand Up @@ -34,28 +26,27 @@ RUN cd sdk && rm -rf .git && mv ../ac-m4-py.patch ./ && git apply ac-m4-py.patch
make -j $(nproc) && cd bindings/python/ && python3 setup.py bdist_wheel && \
ls -lh dist/megasdk*

FROM ghcr.io/ksssomesh12/tgmb-beta:base as app-base
FROM ghcr.io/ksssomesh12/tgmb-beta:api as app-api
FROM ghcr.io/ksssomesh12/tgmb-beta:sdk as app-sdk

FROM scratch as app
COPY --from=app-base / /
FROM ubuntu:jammy as app
COPY --from=app-api /root/api/bin/telegram-bot-api /usr/bin/telegram-bot-api
COPY --from=app-sdk /root/sdk /root/sdk
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' TZ='Asia/Kolkata'
ENV DEBIAN_FRONTEND='noninteractive'
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' TZ='Asia/Kolkata'
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y libcrypto++-dev libfreeimage-dev && \
apt-get install -y software-properties-common && \
apt-get install -y aria2 curl ffmpeg jq locales nano pv python3 python3-pip python3-lxml tzdata && \
apt-get install -y libc++-dev libmagic-dev libcrypto++-dev libfreeimage-dev software-properties-common && \
add-apt-repository ppa:qbittorrent-team/qbittorrent-stable && \
apt-get install -y qbittorrent-nox && \
apt-get purge -y software-properties-common && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8
RUN pip3 install --no-cache-dir /root/sdk/bindings/python/dist/megasdk-*.whl
WORKDIR /usr/src/app
RUN chmod 777 /usr/src/app
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
COPY . .
COPY tgmb tgmb
CMD ["python3", "-m", "tgmb"]

0 comments on commit 33f900c

Please sign in to comment.