Skip to content

Commit

Permalink
repo: build both client and server
Browse files Browse the repository at this point in the history
  • Loading branch information
ivynya committed Dec 25, 2023
1 parent d1deaed commit 58861fb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit 58861fb

Please sign in to comment.