From 58861fb4d9adf39529c6532cf7091394208632c5 Mon Sep 17 00:00:00 2001 From: ivynya Date: Mon, 25 Dec 2023 12:48:01 -0800 Subject: [PATCH] repo: build both client and server --- .github/workflows/main.yml | 10 +++++++++- Dockerfile | 10 +++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3d2da0f..bb1916c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,10 +17,18 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build Docker image + - name: Build Docker server image uses: docker/build-push-action@v4 with: context: . push: true + target: server tags: ghcr.io/${{ github.repository }}/server:latest + - name: Build Docker client image + uses: docker/build-push-action@v4 + with: + context: . + push: true + target: client + tags: ghcr.io/${{ github.repository }}/client:latest diff --git a/Dockerfile b/Dockerfile index f4550cd..9ac52c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,16 @@ COPY . . RUN go mod download RUN go build -o server ./server +RUN go build -o client ./client EXPOSE 3000 -FROM alpine:latest AS runner +FROM alpine:latest AS server WORKDIR /app COPY --from=builder /app/server . - -# Run the app when the container launches CMD ["./server"] + +FROM alpine:latest AS client +WORKDIR /app +COPY --from=builder /app/client . +CMD ["./client"]