-
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor build configuration and Dockerfile for Platypus web app admin
- Loading branch information
1 parent
595c243
commit 9789cb7
Showing
7 changed files
with
246 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: platypus-agent | ||
|
||
on: | ||
push: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}-agent | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern=v{{version}} | ||
type=semver,pattern=v{{major}}.{{minor}} | ||
type=sha,prefix=,suffix=,format=short | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to Selfhosted Docker Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: cmd/agent/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
annotations: ${{ steps.meta.outputs.annotations }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: platypus-frontend | ||
|
||
on: | ||
push: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}-frontend | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern=v{{version}} | ||
type=semver,pattern=v{{major}}.{{minor}} | ||
type=sha,prefix=,suffix=,format=short | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to Selfhosted Docker Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: web/platypus | ||
file: web/platypus/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
annotations: ${{ steps.meta.outputs.annotations }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: platypus-server | ||
|
||
on: | ||
push: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}-server | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern=v{{version}} | ||
type=semver,pattern=v{{major}}.{{minor}} | ||
type=sha,prefix=,suffix=,format=short | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to Selfhosted Docker Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: cmd/server/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
annotations: ${{ steps.meta.outputs.annotations }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM golang:1.22.6 AS builder | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
RUN go install github.com/goreleaser/goreleaser/[email protected] | ||
|
||
WORKDIR /app | ||
COPY . . | ||
|
||
# Check if the current commit is tagged, and build accordingly | ||
RUN if git describe --tags --exact-match >/dev/null 2>&1; then \ | ||
echo "Commit is tagged. Creating a release build."; \ | ||
goreleaser build --id platypus-admin --clean; \ | ||
else \ | ||
echo "Commit is not tagged. Creating a snapshot build."; \ | ||
goreleaser build --id platypus-admin --clean --snapshot; \ | ||
fi | ||
|
||
FROM alpine:3.12 | ||
RUN apk add --no-cache ca-certificates | ||
COPY --from=builder /app/dist/platypus-admin_${TARGETOS}_${TARGETARCH}_v1/platypus-admin /usr/local/bin/platypus-admin | ||
ENTRYPOINT [ "/usr/local/bin/platypus-admin" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM golang:1.22.6 AS builder | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
RUN go install github.com/goreleaser/goreleaser/[email protected] | ||
|
||
WORKDIR /app | ||
COPY . . | ||
|
||
# Check if the current commit is tagged, and build accordingly | ||
RUN if git describe --tags --exact-match >/dev/null 2>&1; then \ | ||
echo "Commit is tagged. Creating a release build."; \ | ||
goreleaser build --id platypus-agent --clean; \ | ||
else \ | ||
echo "Commit is not tagged. Creating a snapshot build."; \ | ||
goreleaser build --id platypus-agent --clean --snapshot; \ | ||
fi | ||
|
||
FROM alpine:3.12 | ||
RUN apk add --no-cache ca-certificates | ||
COPY --from=builder /app/dist/platypus-agent_${TARGETOS}_${TARGETARCH}_v1/platypus-agent /usr/local/bin/platypus-agent | ||
ENTRYPOINT [ "/usr/local/bin/platypus-agent" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM golang:1.22.6 AS builder | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
RUN go install github.com/goreleaser/goreleaser/[email protected] | ||
|
||
WORKDIR /app | ||
COPY . . | ||
|
||
# Check if the current commit is tagged, and build accordingly | ||
RUN if git describe --tags --exact-match >/dev/null 2>&1; then \ | ||
echo "Commit is tagged. Creating a release build."; \ | ||
goreleaser build --id platypus-server --clean; \ | ||
else \ | ||
echo "Commit is not tagged. Creating a snapshot build."; \ | ||
goreleaser build --id platypus-server --clean --snapshot; \ | ||
fi | ||
|
||
FROM alpine:3.12 | ||
RUN apk add --no-cache ca-certificates | ||
COPY --from=builder /app/dist/platypus-server_${TARGETOS}_${TARGETARCH}_v1/platypus-server /usr/local/bin/platypus-server | ||
ENTRYPOINT [ "/usr/local/bin/platypus-server" ] |