Skip to content

Commit

Permalink
update dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
metowolf committed Jul 18, 2023
1 parent 8a28c60 commit 4a2d0f2
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
temp
public
*.zip
.DS_Store
radicale
19 changes: 17 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
release-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -17,4 +17,19 @@ jobs:
yarn install
yarn test
yarn build
gh release create $(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1) public/*
gh release create $(date +'%Y%m%d%H%M%S')-$(git log --format=%h -1) public/*
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build image and push
env:
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
IMAGE_VERSION=`cat package.json | jq -r '.version'`
echo $DOCKER_TOKEN | docker login -u metowolf --password-stdin
docker build -t metowolf/vcards:$IMAGE_VERSION --squash --push .
echo $GITHUB_TOKEN | docker login ghcr.io -u metowolf --password-stdin
docker build -t ghcr.io/metowolf/vcards:$IMAGE_VERSION --squash --push .
51 changes: 51 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FROM node as builder

COPY . /app
WORKDIR /app
RUN yarn && yarn radicale


FROM alpine

RUN apk add --no-cache \
radicale \
&& rm -rf /var/cache/apk/* \
\
&& { \
echo '[root]'; \
echo 'user: .+'; \
echo 'collection:'; \
echo 'permissions: R'; \
echo; \
echo '[principal]'; \
echo 'user: .+'; \
echo 'collection: {user}'; \
echo 'permissions: R'; \
echo; \
echo '[collections]'; \
echo 'user: .+'; \
echo 'collection: {user}/[^/]+'; \
echo 'permissions: rR'; \
} > /etc/radicale/rights \
\
&& { \
echo '[server]'; \
echo 'hosts = 0.0.0.0:5232, [::]:5232'; \
echo; \
echo '[web]'; \
echo 'type = none'; \
echo; \
echo '[storage]'; \
echo 'type = multifilesystem'; \
echo 'filesystem_folder = /app/vcards'; \
echo; \
echo '[rights]'; \
echo 'type = from_file'; \
echo 'file = /etc/radicale/rights'; \
} > /etc/radicale/config

COPY --from=builder /app/radicale/ /app/vcards/collection-root/cn/

EXPOSE 5232

CMD ["radicale"]
4 changes: 2 additions & 2 deletions src/plugins/vcard-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const plugin = (file, _, cb) => {
}

vCard.photo.embedFromFile(path.replace('.yaml', '.png'))
let lastYamlChangeDateString = execSync('git log -1 --pretty="format:%ci" ' + path).toString().trim().replace(/\s\+\d+/, '')
let lastPngChangeDateString = execSync('git log -1 --pretty="format:%ci" ' + path.replace('.yaml', '.png')).toString().trim().replace(/\s\+\d+/, '')
let lastYamlChangeDateString = execSync(`git log -1 --pretty="format:%ci" "${path}"`).toString().trim().replace(/\s\+\d+/, '')
let lastPngChangeDateString = execSync(`git log -1 --pretty="format:%ci" "${path.replace('yaml', 'png')}"`).toString().trim().replace(/\s\+\d+/, '')

let rev = new Date(Math.max(new Date(lastYamlChangeDateString), new Date(lastPngChangeDateString))).toISOString()

Expand Down

0 comments on commit 4a2d0f2

Please sign in to comment.