Skip to content

Commit

Permalink
Fix ci pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
kysre committed Feb 3, 2024
1 parent 2cc1a9a commit 282bb43
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 25 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ jobs:
name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./leader/Dockerfile
push: true
target: leader
tags: kysre/turtlemq:leader-latest

data-node:
datanode:
runs-on: ubuntu-latest
steps:
-
Expand All @@ -48,6 +49,7 @@ jobs:
name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./datanode/Dockerfile
push: true
target: data-node
tags: kysre/turtlemq:datanode-latest
tags: kysre/turtlemq:datanode-latest
20 changes: 16 additions & 4 deletions .github/workflows/dev.build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ jobs:
leader:
runs-on: ubuntu-latest
steps:
-
name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -26,13 +31,19 @@ jobs:
name: Build and push
uses: docker/build-push-action@v5
with:
context: ./leader
file: ./leader/Dockerfile
push: true
target: leader
tags: kysre/turtlemq:leader-${{ steps.extract_branch.outputs.branch }}

data-node:
datanode:
runs-on: ubuntu-latest
steps:
-
name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -49,6 +60,7 @@ jobs:
name: Build and push
uses: docker/build-push-action@v5
with:
context: ./datanode
file: ./datanode/Dockerfile
push: true
target: data-node
tags: kysre/turtlemq:datanode-${{ steps.extract_branch.outputs.branch }}
tags: kysre/turtlemq:datanode-${{ steps.extract_branch.outputs.branch }}
10 changes: 10 additions & 0 deletions datanode/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.10-slim

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install -r requirements.txt

COPY ./src ./src

EXPOSE 1234
23 changes: 6 additions & 17 deletions Dockerfile → leader/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
FROM python:3.10-slim AS data-node

WORKDIR /usr/src/app

COPY datanode/requirements.txt ./
RUN pip install -r requirements.txt

COPY ./datanode/src ./src

EXPOSE 1234

FROM golang:1.21-bookworm AS leader-build
FROM golang:1.21-bookworm AS build
WORKDIR /srv/build

ARG no_proxy
ARG NO_PROXY

RUN apt update --fix-missing

ADD Makefile leader/go.mod leader/go.sum ./
ADD Makefile go.mod go.sum ./
RUN go mod download

COPY ./leader .
COPY . .
RUN go build -o $@ leader ./cmd/$@


FROM debian:bookworm as leader
FROM debian:bookworm as final

RUN apt update --fix-missing && \
apt-get upgrade -y && \
Expand All @@ -39,9 +28,9 @@ RUN apt install -y nano vim

WORKDIR /srv/build

COPY --from=leader-build /srv/build/. /srv/build
COPY --from=build /srv/build/. /srv/build

COPY --from=leader-build /srv/build/leader /bin/
COPY --from=build /srv/build/leader /bin/

RUN echo $(ls /bin)

Expand Down

0 comments on commit 282bb43

Please sign in to comment.