mirror of
https://github.com/shenxn/protonmail-bridge-docker.git
synced 2025-12-06 08:27:08 +00:00
Improve build
This commit is contained in:
parent
f50fb12487
commit
b8296a70d6
@ -1,7 +1,7 @@
|
||||
*
|
||||
|
||||
!.dockerignore
|
||||
!releaserc
|
||||
!VERSION
|
||||
!entrypoint.sh
|
||||
!install.sh
|
||||
!gpgparams
|
||||
|
||||
52
.github/workflows/main.yaml
vendored
52
.github/workflows/main.yaml
vendored
@ -2,10 +2,9 @@ name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
repository_dispatch:
|
||||
types: build
|
||||
branches:
|
||||
- master
|
||||
- dev
|
||||
|
||||
env:
|
||||
DOCKER_TAG: shenxn/protonmail-bridge
|
||||
@ -14,37 +13,14 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Set Env
|
||||
run: |
|
||||
source releaserc
|
||||
echo "::set-env name=RELEASE::${RELEASE}"
|
||||
echo "::set-env name=DEB_FILE::${DEB_FILE}"
|
||||
- name: Repack deb
|
||||
run: bash repack-deb.sh
|
||||
- name: Create Release
|
||||
id: create-release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ env.RELEASE }}
|
||||
release_name: Release ${{ env.RELEASE }}
|
||||
body: Repacked ProtonMail Bridge deb without dependencies not needed by cli mode.
|
||||
draft: false
|
||||
prerelease: false
|
||||
- name: Upload Release Asset
|
||||
id: upload-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create-release.outputs.upload_url }}
|
||||
asset_path: ./deb/${{ env.DEB_FILE }}
|
||||
asset_name: ${{ env.DEB_FILE }}
|
||||
asset_content_type: application/vnd.debian.binary-package
|
||||
- name: Push Tag to Trigger Docker Hub Build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: bash push-tag.sh
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Set Env
|
||||
run: bash set-env.sh
|
||||
- uses: docker/build-push-action@v1
|
||||
with:
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
repository: shenxn/protonmail-bridge
|
||||
tags: ${{ env.TAGS }}
|
||||
add_git_labels: true
|
||||
|
||||
@ -4,10 +4,12 @@ LABEL maintainer="Xiaonan Shen <s@sxn.dev>"
|
||||
EXPOSE 25/tcp
|
||||
EXPOSE 143/tcp
|
||||
|
||||
WORKDIR /protonmail
|
||||
|
||||
# Copy bash scripts
|
||||
COPY gpgparams install.sh entrypoint.sh releaserc /protonmail/
|
||||
COPY gpgparams install.sh entrypoint.sh VERSION /protonmail/
|
||||
|
||||
# Install dependencies and protonmail bridge
|
||||
RUN bash /protonmail/install.sh
|
||||
RUN bash install.sh
|
||||
|
||||
ENTRYPOINT ["bash", "/protonmail/entrypoint.sh"]
|
||||
|
||||
27
install.sh
27
install.sh
@ -2,21 +2,32 @@
|
||||
|
||||
set -ex
|
||||
|
||||
source /protonmail/releaserc
|
||||
VERSION=`cat VERSION`
|
||||
DEB_FILE=protonmail-bridge_${VERSION}_amd64.deb
|
||||
|
||||
# Install dependents
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends socat pass
|
||||
|
||||
# Download repacked deb
|
||||
apt-get install -y wget
|
||||
wget -O /protonmail/protonmail.deb https://github.com/shenxn/protonmail-bridge-docker/releases/download/${RELEASE}/${DEB_FILE}
|
||||
apt-get purge -y wget
|
||||
apt-get autoremove -y
|
||||
# Build time dependencies
|
||||
apt-get install -y wget binutils xz-utils
|
||||
|
||||
# Repack deb (remove unnecessary dependencies)
|
||||
wget https://protonmail.com/download/${DEB_FILE}
|
||||
ar x -v ${DEB_FILE}
|
||||
mkdir control
|
||||
tar xvfJ control.tar.xz -C control
|
||||
sed -i "s/^Depends: .*$/Depends: libsecret-1-0, libgl1-mesa-glx/" control/control
|
||||
cd control
|
||||
tar cvfJ ../control.tar.xz .
|
||||
cd ../
|
||||
ar rcs -v ${DEB_FILE} debian-binary control.tar.xz data.tar.xz
|
||||
|
||||
# Install protonmail bridge
|
||||
apt-get install -y --no-install-recommends /protonmail/protonmail.deb
|
||||
apt-get install -y --no-install-recommends ./${DEB_FILE}
|
||||
|
||||
# Cleanup
|
||||
apt-get purge -y wget binutils xz-utils
|
||||
apt-get autoremove -y
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
rm /protonmail/protonmail.deb
|
||||
rm ${DEB_FILE}
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
RELEASE=1.2.7-1
|
||||
DEB_FILE=protonmail-bridge_${RELEASE}_amd64.deb
|
||||
@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
source releaserc
|
||||
|
||||
# Download deb
|
||||
mkdir deb
|
||||
cd deb
|
||||
rm -f ${DEB_FILE}
|
||||
wget https://protonmail.com/download/${DEB_FILE}
|
||||
|
||||
# Unpack deb
|
||||
ar x -v ${DEB_FILE}
|
||||
mkdir control
|
||||
tar xvfJ control.tar.xz -C control
|
||||
|
||||
# Replace qt with libgl and remove unnecessary dependencies
|
||||
sed -i "s/^Depends: .*$/Depends: libsecret-1-0, libgl1-mesa-glx/" control/control
|
||||
|
||||
# Pack deb
|
||||
cd control
|
||||
tar cvfJ ../control.tar.xz .
|
||||
cd ../
|
||||
ar rcs -v ${DEB_FILE} debian-binary control.tar.xz data.tar.xz
|
||||
11
set-env.sh
Normal file
11
set-env.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
VERSION=`cat VERSION`
|
||||
|
||||
if [[ $GITHUB_REF == "master" ]]; then
|
||||
echo "::set-env name=TAGS::latest,${VERSION}"
|
||||
else
|
||||
echo "::set-env name=TAGS::dev,${VERSION}-dev"
|
||||
fi
|
||||
Loading…
Reference in New Issue
Block a user