fix(ci): standardize backend service/image naming to hyphen format
This commit is contained in:
parent
00629446a7
commit
f4515b22a2
2 changed files with 18 additions and 16 deletions
|
|
@ -7,20 +7,20 @@ matrix:
|
|||
- gateway
|
||||
- users
|
||||
- companies
|
||||
- job_seekers
|
||||
- job-seekers
|
||||
- customers
|
||||
- payments
|
||||
- employees
|
||||
- photographers
|
||||
- makeup_artists
|
||||
- makeup-artists
|
||||
- tutors
|
||||
- developers
|
||||
- video_editors
|
||||
- graphic_designers
|
||||
- social_media_managers
|
||||
- fitness_trainers
|
||||
- catering_services
|
||||
- ugc_content_creators
|
||||
- video-editors
|
||||
- graphic-designers
|
||||
- social-media-managers
|
||||
- fitness-trainers
|
||||
- catering-services
|
||||
- ugc-content-creators
|
||||
- cron
|
||||
|
||||
steps:
|
||||
|
|
|
|||
|
|
@ -16,12 +16,13 @@ WORKDIR /app
|
|||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY crates/ ./crates/
|
||||
|
||||
# Copy only the target service source (fast path for matrix builds).
|
||||
COPY apps/${SERVICE_NAME}/ ./apps/${SERVICE_NAME}/
|
||||
# Copy all services so we can map hyphenated service names to underscore crate/bin names.
|
||||
COPY apps/ ./apps/
|
||||
|
||||
# Restrict workspace members to the selected service + shared crates.
|
||||
# This avoids requiring every `apps/*` manifest while preserving workspace deps.
|
||||
RUN awk -v svc="${SERVICE_NAME}" '\
|
||||
RUN svc=$(echo "${SERVICE_NAME}" | tr '-' '_') && \
|
||||
awk -v svc="${svc}" '\
|
||||
BEGIN { in_members = 0 } \
|
||||
/^members = \[/ { \
|
||||
print "members = ["; \
|
||||
|
|
@ -37,22 +38,23 @@ RUN awk -v svc="${SERVICE_NAME}" '\
|
|||
} \
|
||||
in_members && /^\]/ { in_members = 0; print "]"; next } \
|
||||
in_members { next } \
|
||||
{ print }' Cargo.toml > Cargo.toml.tmp && mv Cargo.toml.tmp Cargo.toml
|
||||
{ print }' Cargo.toml > Cargo.toml.tmp && mv Cargo.toml.tmp Cargo.toml && \
|
||||
echo "${svc}" > /tmp/service_bin
|
||||
|
||||
# Build with all optimizations
|
||||
ENV RUSTFLAGS="-C target-feature=+crt-static -C link-arg=-s"
|
||||
ENV OPENSSL_STATIC=1
|
||||
ENV OPENSSL_DIR=/usr
|
||||
RUN cargo build --release \
|
||||
--bin ${SERVICE_NAME} \
|
||||
--target x86_64-unknown-linux-musl
|
||||
--bin $(cat /tmp/service_bin) \
|
||||
--target x86_64-unknown-linux-musl && \
|
||||
cp /app/target/x86_64-unknown-linux-musl/release/$(cat /tmp/service_bin) /app/service
|
||||
|
||||
# Runtime
|
||||
FROM scratch
|
||||
ARG SERVICE_NAME
|
||||
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/${SERVICE_NAME} /app/service
|
||||
COPY --from=builder /app/service /app/service
|
||||
|
||||
USER 65532:65532
|
||||
EXPOSE 8000
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue