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
58 changes: 0 additions & 58 deletions .github/workflows/ci.yml

This file was deleted.

10 changes: 8 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Build and Push Container
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
inputs:
tag:
Expand All @@ -26,7 +27,7 @@ jobs:
packages: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set tag
id: tag
Expand All @@ -44,9 +45,14 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
31 changes: 9 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
# syntax=docker/dockerfile:1
# Based on https://depot.dev/docs/container-builds/optimal-dockerfiles/rust-dockerfile

FROM rust:1 AS build

FROM rust:1-trixie AS chef
RUN cargo install cargo-chef --locked
Comment thread
niklasf marked this conversation as resolved.

WORKDIR /app

COPY Cargo.toml Cargo.lock ./
COPY src ./src

RUN cargo chef prepare --recipe-path recipe.json

RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
--mount=type=cache,target=/usr/local/cargo/git,sharing=locked \
cargo chef cook --release --recipe-path recipe.json

FROM chef AS planner
COPY . .
RUN cargo chef prepare

RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
--mount=type=cache,target=/usr/local/cargo/git,sharing=locked \
cargo build --release --bin lila-push
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release
COPY . .
RUN cargo build --release

FROM debian:trixie-slim AS runtime

RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*

RUN groupadd -g 1001 lichess && \
useradd -u 1001 -g lichess -m -d /home/lichess -s /bin/bash lichess

COPY --from=build --chown=lichess:lichess /app/target/release/lila-push /usr/local/bin/lila-push

COPY --from=builder --chown=lichess:lichess /app/target/release/lila-push /usr/local/bin/lila-push
Comment thread
niklasf marked this conversation as resolved.
USER lichess

ENTRYPOINT ["/usr/local/bin/lila-push"]
12 changes: 0 additions & 12 deletions lila-push.service

This file was deleted.

9 changes: 0 additions & 9 deletions lila-push.socket

This file was deleted.