mirror of
https://github.com/GothenburgBitFactory/taskchampion-sync-server.git
synced 2025-06-26 10:54:29 +02:00
feat(docker): simplify docker compose for end users (#96)
* feat(docker): simplify docker compose for end users The previous docker-compose requires end user to manually handle permissions of taskchampion data dir. And this commit has directories automatically set up in docker-entrypoint.sh, just like what postgresql did in https://github.com/docker-library/postgres/blob/master/docker-entrypoint.sh * fix(docker): revert to anonymous data volume for compatibility * feat: use uid 1092 for taskchampion * fix(docker): revert mkdir This is embarrassing that subpaths are not automatically created. So we still need mkdir service in case of anonymous data volume. * fix(docker): typo
This commit is contained in:
parent
c47612b3a0
commit
65ad035d8d
4 changed files with 42 additions and 19 deletions
22
Dockerfile
22
Dockerfile
|
@ -1,19 +1,25 @@
|
|||
# Versions must be major.minor
|
||||
ARG RUST_VERSION
|
||||
ARG ALPINE_VERSION
|
||||
# Default versions are as below
|
||||
ARG RUST_VERSION=1.78
|
||||
ARG ALPINE_VERSION=3.19
|
||||
|
||||
FROM docker.io/rust:${RUST_VERSION}-alpine${ALPINE_VERSION} AS builder
|
||||
COPY . /data
|
||||
COPY Cargo.lock Cargo.toml /data/
|
||||
COPY core /data/core/
|
||||
COPY server /data/server/
|
||||
COPY sqlite /data/sqlite/
|
||||
RUN apk -U add libc-dev && \
|
||||
cd /data && \
|
||||
cargo build --release
|
||||
|
||||
FROM docker.io/alpine:${ALPINE_VERSION}
|
||||
COPY --from=builder /data/target/release/taskchampion-sync-server /bin
|
||||
RUN adduser -S -D -H -h /var/lib/taskchampion-sync-server -s /sbin/nologin -G users \
|
||||
RUN apk add --no-cache su-exec && \
|
||||
adduser -u 1092 -S -D -H -h /var/lib/taskchampion-sync-server -s /sbin/nologin -G users \
|
||||
-g taskchampion taskchampion && \
|
||||
install -d -m755 -o100 -g100 "/var/lib/taskchampion-sync-server"
|
||||
install -d -m1755 -o1092 -g1092 "/var/lib/taskchampion-sync-server"
|
||||
EXPOSE 8080
|
||||
VOLUME "/var/lib/taskchampion-sync-server"
|
||||
USER taskchampion
|
||||
ENTRYPOINT [ "taskchampion-sync-server" ]
|
||||
VOLUME /var/lib/task-champion-sync-server/data
|
||||
COPY docker-entrypoint.sh /bin
|
||||
ENTRYPOINT [ "/bin/docker-entrypoint.sh" ]
|
||||
CMD [ "/bin/taskchampion-sync-server" ]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue