Skip to content

feat: Add support for shell in anki-sync-server image entrypoint #5

feat: Add support for shell in anki-sync-server image entrypoint

feat: Add support for shell in anki-sync-server image entrypoint #5

name: build-and-push-sync-server
on:
workflow_dispatch:
push:
branches:
- master
- develop
paths:
#Build and push when anki-sync-server files change
- 'services/anki-sync-server/**'
env:
ANKISYNCD_AUTH_DB_PATH: ./auth.db
ANKISYNCD_BASE_MEDIA_URL: /msync/
ANKISYNCD_BASE_URL: /sync/
ANKISYNCD_DATA_ROOT: ./collections
ANKISYNCD_SESSION_DB_PATH: ./session.db
ANKISYNCD_PORT: 27701
jobs:
build-and-push-sync-server:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU for multi-platform builds
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get branch name
id: extract_branch
shell: bash
# Tag master as latest, otherwise, tag as latest-BRANCH
run: echo "##[set-output name=branchtag;]$(if [ $GITHUB_REF == 'refs/heads/master' ]; then echo ''; else echo -${GITHUB_REF##*/}; fi)"
- name: Get date
id: get_date
shell: bash
run: echo "##[set-output name=datetag;]$(date +%Y%m%d)"
- name: Build for various platforms and push to Dockerhub
uses: docker/build-push-action@v2
with:
context: services/anki-sync-server/images
platforms: linux/amd64
push: true
tags: |
ankicommunity/anki-sync-server:latest${{ steps.extract_branch.outputs.branchtag }}
ankicommunity/anki-sync-server:${{ steps.get_date.outputs.datetag }}
build-args: |
ANKISYNCD_PORT=${{ env.ANKISYNCD_PORT }}
ANKISYNCD_BASE_URL=${{ env.ANKISYNCD_BASE_URL }}
ANKISYNCD_BASE_MEDIA_URL=${{ env.ANKISYNCD_BASE_MEDIA_URL }}
ANKISYNCD_AUTH_DB_PATH=${{ env.ANKISYNCD_AUTH_DB_PATH }}
ANKISYNCD_SESSION_DB_PATH=${{ env.ANKISYNCD_SESSION_DB_PATH }}
ANKISYNCD_DATA_ROOT=${{ env.ANKISYNCD_DATA_ROOT }}