Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
!core/
!server/
!sqlite/
!docker-entrypoint.sh
!postgres/
!entrypoint-*
3 changes: 0 additions & 3 deletions .env

This file was deleted.

49 changes: 37 additions & 12 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,42 @@ on:
- '*'

jobs:
docker:
sqlite:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Load .env file
uses: xom9ikk/dotenv@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta-sqlite
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/gothenburgbitfactory/taskchampion-sync-server
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=match,pattern=\d.\d.\d,value=latest
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
path: "{context}/Dockerfile-sqlite"
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta-sqlite.outputs.tags }}
labels: ${{ steps.meta-sqlite.outputs.labels }}
postgres:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
Expand All @@ -24,11 +51,11 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
id: meta-postgres
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
ghcr.io/gothenburgbitfactory/taskchampion-sync-server-postgres
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
Expand All @@ -38,10 +65,8 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
path: "{context}/Dockerfile-postgres"
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ALPINE_VERSION=${{ env.ALPINE_VERSION }}
RUST_VERSION=${{ env.RUST_VERSION }}
tags: ${{ steps.meta-postgres.outputs.tags }}
labels: ${{ steps.meta-postgres.outputs.labels }}
104 changes: 16 additions & 88 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ tokio = { version = "*", features = ["rt", "macros"] }
tokio-postgres = { version = "0.7.13", features = ["with-uuid-1"] }
bb8 = "0.9.0"
bb8-postgres = { version = "0.9.0", features = ["with-uuid-1"] }
openssl = { version = "0.10.73", default-features = false, features = ["vendored"] }
native-tls = { version = "0.2.14", default-features = false, features = ["vendored"] }
postgres-native-tls = "0.5.1"
26 changes: 26 additions & 0 deletions Dockerfile-postgres
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Versions must be major.minor
# Default versions are as below
ARG RUST_VERSION=1.85
ARG ALPINE_VERSION=3.20

FROM docker.io/rust:${RUST_VERSION}-alpine${ALPINE_VERSION} AS builder
# perl and make are required to build openssl.
RUN apk -U add libc-dev perl make
COPY Cargo.lock Cargo.toml /data/
COPY core /data/core/
COPY server /data/server/
COPY postgres /data/postgres/
COPY sqlite /data/sqlite/
RUN cd /data && \
cargo build -p taskchampion-sync-server --release --no-default-features --features postgres --bin taskchampion-sync-server-postgres

FROM docker.io/alpine:${ALPINE_VERSION}
COPY --from=builder /data/target/release/taskchampion-sync-server-postgres /bin
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 -m1755 -o1092 -g1092 "/var/lib/taskchampion-sync-server"
EXPOSE 8080
COPY entrypoint-postgres.sh /bin/entrypoint.sh
ENTRYPOINT [ "/bin/entrypoint.sh" ]
CMD [ "/bin/taskchampion-sync-server-postgres" ]
15 changes: 8 additions & 7 deletions Dockerfile → Dockerfile-sqlite
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Versions must be major.minor
# Default versions are as below
ARG RUST_VERSION=1.78
ARG ALPINE_VERSION=3.19
ARG RUST_VERSION=1.85
ARG ALPINE_VERSION=3.20

FROM docker.io/rust:${RUST_VERSION}-alpine${ALPINE_VERSION} AS builder
RUN apk -U add libc-dev
COPY Cargo.lock Cargo.toml /data/
COPY core /data/core/
COPY server /data/server/
COPY postgres /data/postgres/
COPY sqlite /data/sqlite/
RUN apk -U add libc-dev && \
cd /data && \
cargo build --release
RUN cd /data && \
cargo build --release --bin taskchampion-sync-server

FROM docker.io/alpine:${ALPINE_VERSION}
COPY --from=builder /data/target/release/taskchampion-sync-server /bin
Expand All @@ -20,6 +21,6 @@ RUN apk add --no-cache su-exec && \
install -d -m1755 -o1092 -g1092 "/var/lib/taskchampion-sync-server"
EXPOSE 8080
VOLUME /var/lib/taskchampion-sync-server/data
COPY docker-entrypoint.sh /bin
ENTRYPOINT [ "/bin/docker-entrypoint.sh" ]
COPY entrypoint-sqlite.sh /bin/entrypoint.sh
ENTRYPOINT [ "/bin/entrypoint.sh" ]
CMD [ "/bin/taskchampion-sync-server" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ cargo build --release
After build the binary is located in
`target/release/taskchampion-sync-server`.

#### Building the Postgres backend
#### Building the Postgres Backend

The storage backend is controlled by Cargo features `postres` and `sqlite`.
By default, only the `sqlite` feature is enabled.
Expand Down
6 changes: 6 additions & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@

- [Introduction](./introduction.md)
- [Usage](./usage.md)
- [Docker Compose](./usage/docker-compose.md)
- [Docker Images](./usage/docker-images.md)
- [Binaries](./usage/binaries.md)
- [Integration](./integration.md)
- [Pre-built Images](./integration/pre-built.md)
- [Rust Crates](./integration/crates.md)
- [Sync Protocol Implementation](./integration/protocol-impl.md)
Loading
Loading