Skip to content

Commit

Permalink
copy workflows from main
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGANGLOFF committed Apr 8, 2024
1 parent d13cc62 commit 18fb90a
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 10 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/rust-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Rust-test

on:
push:
branches:
- main
- service-eat
- service-auth
- service-drink
- service-sleep
- service-enjoy
- service-travel
workflow_dispatch:
env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Stage de construction
FROM rust:latest as builder
FROM rust:latest@sha256:84d4e88a86481073bf876770768632d8c7783fc58f14fbd67b387f75f889db23 as builder

# Copiez tous les membres du workspace ainsi que le fichier de workspace.
# Pre-building de drink pour le caching des dépendances
WORKDIR /usr/src/drink
# Pre-building de eat pour le caching des dépendances
WORKDIR /usr/src/eat
COPY ./Cargo.toml ./Cargo.toml
COPY ./common ./common
COPY ./services ./services
Expand All @@ -12,12 +12,13 @@ COPY .env .env
# Création du build release
RUN cargo build --release


# Stage d'exécution
FROM ubuntu:latest
FROM debian:bookworm@sha256:c2cedd7f80a4dd0f9f80d3699bd433ccf3de33ab63bfa2d4c4ba870c998222d6
RUN apt-get update && apt-get install -y openssl && apt-get install -y ca-certificates && \
update-ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/src/drink/target/release/drink /usr/local/bin/drink
EXPOSE 8003
COPY --from=builder /usr/src/eat/target/release/eat /usr/local/bin/eat
EXPOSE 8002

CMD ["drink"]
CMD ["eat"]
37 changes: 37 additions & 0 deletions deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: eat
namespace: eat
labels:
name: eat
spec:
replicas: 2
selector:
matchLabels:
app: eat
template:
metadata:
labels:
app: eat
spec:
containers:
- name: eat
image: d3spina/t-web-800:eat-latest
imagePullPolicy: Always
env:
- name: ROCKET_ADDRESS
value: "0.0.0.0"
- name: ROCKET_PORT
value: "8002"
ports:
- containerPort: 8002
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
imagePullSecrets:
- name: my-docker-credentials
7 changes: 4 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ services:
build:
context: .
dockerfile: Dockerfile
image: drink
image: eat
ports:
- "8003:8000"
- "8002:8002"
environment:
ROCKET_ADDRESS: "0.0.0.0"
ROCKET_ADDRESS: "0.0.0.0"
ROCKET_PORT: "8002"
13 changes: 13 additions & 0 deletions service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: eat-service
namespace: eat
spec:
selector:
app: eat
ports:
- protocol: TCP
port: 80
targetPort: 8002
type: LoadBalancer

0 comments on commit 18fb90a

Please sign in to comment.