forked from laurent22/joplin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tools: Allow building Docker image from CI
- Loading branch information
Showing
10 changed files
with
85 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,18 +12,40 @@ jobs: | |
# exist) since otherwise it will make the whole build fails, even though | ||
# it might work without update. libsecret-1-dev is required for keytar - | ||
# https://github.com/atom/node-keytar | ||
|
||
- name: Install Linux dependencies | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get update || true | ||
sudo apt-get install -y gettext | ||
sudo apt-get install -y libsecret-1-dev | ||
- name: Install Docker Engine | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get install -y apt-transport-https | ||
sudo apt-get install -y ca-certificates | ||
sudo apt-get install -y curl | ||
sudo apt-get install -y gnupg | ||
sudo apt-get install -y lsb-release | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | ||
echo \ | ||
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ | ||
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
sudo apt-get update || true | ||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io | ||
- uses: actions/checkout@v2 | ||
- uses: olegtarasov/[email protected] | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '12' | ||
|
||
- uses: docker/login-action@v1 | ||
if: runner.os == 'Linux' | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Run script... | ||
env: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { execCommand2, rootDir } from './tool-utils'; | ||
|
||
function getVersionFromTag(tagName: string): string { | ||
if (tagName.indexOf('server-') !== 0) throw new Error(`Invalid tag: ${tagName}`); | ||
const s = tagName.split('-'); | ||
return s[1]; | ||
} | ||
|
||
function getIsPreRelease(tagName: string): boolean { | ||
return tagName.indexOf('-beta') > 0; | ||
} | ||
|
||
async function main() { | ||
const argv = require('yargs').argv; | ||
if (!argv.tagName) throw new Error('--tag-name not provided'); | ||
|
||
const tagName = argv.tagName; | ||
const imageVersion = getVersionFromTag(tagName); | ||
const isPreRelease = getIsPreRelease(tagName); | ||
|
||
process.chdir(rootDir); | ||
console.info(`Running from: ${process.cwd()}`); | ||
|
||
console.info('tagName:', tagName); | ||
console.info('imageVersion:', imageVersion); | ||
console.info('isPreRelease:', isPreRelease); | ||
|
||
await execCommand2(`docker build -t "joplin/server:${imageVersion}" -f Dockerfile.server .`); | ||
await execCommand2(`docker tag "joplin/server:${imageVersion}" "joplin/server:latest"`); | ||
await execCommand2(`docker push joplin/server:${imageVersion}`); | ||
|
||
if (!isPreRelease) await execCommand2('docker push joplin/server:latest'); | ||
} | ||
|
||
main().catch((error) => { | ||
console.error('Fatal error'); | ||
console.error(error); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters