Skip to content

Commit 7e202a7

Browse files
committed
Build distribution image for job package.
1 parent b544bbf commit 7e202a7

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

.github/workflows/job.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: job
2+
on:
3+
push:
4+
branches:
5+
- distribution
6+
# paths:
7+
# - chloria-backend/chloria-job/**
8+
# - chloria-backend/Dockerfile.dist-job
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Login to Docker Hub
14+
uses: docker/login-action@v3
15+
with:
16+
username: metalwhaledev
17+
password: ${{ secrets.DOCKERHUB_TOKEN }}
18+
- name: Build and push
19+
uses: docker/build-push-action@v6
20+
with:
21+
context: "{{defaultContext}}:chloria-backend"
22+
file: Dockerfile.dist-job
23+
push: true
24+
tags: metalwhaledev/chloria-job:0.1.0

chloria-backend/Dockerfile.dist-job

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Build
2+
FROM rust:1.84.0-bookworm AS build
3+
4+
COPY . /usr/src/chloria-backend/
5+
6+
WORKDIR /usr/src/chloria-backend/
7+
8+
RUN cargo install diesel_cli@2.2.7 --no-default-features --features postgres
9+
RUN cargo build --release --package chloria-job
10+
11+
# Distribution
12+
FROM debian:bookworm-20250203-slim
13+
14+
RUN apt update -y && \
15+
apt install -y libpq5 ca-certificates
16+
17+
COPY --from=build /usr/local/cargo/bin/diesel /bin/diesel
18+
COPY --from=build /usr/src/chloria-backend/target/release/chloria-job /bin/chloria-job
19+
COPY ./migrations /usr/src/chloria-job/migrations
20+
21+
WORKDIR /usr/src/chloria-job/

0 commit comments

Comments
 (0)