aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2024-09-09 10:51:05 -0500
committerMatt Strapp <matt@mattstrapp.net>2024-09-09 10:51:05 -0500
commit427561b32fbc16983f68b7c8cebfad061d9907dd (patch)
treeabd440d8993767181313e12401ee0d7b89cf1d2f
parentChange a SHOULD to a MUST (diff)
downloadlocusts-427561b32fbc16983f68b7c8cebfad061d9907dd.tar
locusts-427561b32fbc16983f68b7c8cebfad061d9907dd.tar.gz
locusts-427561b32fbc16983f68b7c8cebfad061d9907dd.tar.bz2
locusts-427561b32fbc16983f68b7c8cebfad061d9907dd.tar.lz
locusts-427561b32fbc16983f68b7c8cebfad061d9907dd.tar.xz
locusts-427561b32fbc16983f68b7c8cebfad061d9907dd.tar.zst
locusts-427561b32fbc16983f68b7c8cebfad061d9907dd.zip
Simplify Dockerfile and Build
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
-rw-r--r--.github/workflows/docker.yml10
-rw-r--r--Dockerfile11
2 files changed, 9 insertions, 12 deletions
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 69420e1..1f1dd24 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -30,16 +30,6 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- - name: Set up Go
- uses: actions/setup-go@v5
- with:
- go-version: "oldstable"
- - name: Set up Tinygo
- uses: acifani/setup-tinygo@v2
- with:
- install-binaryen: "false"
- - name: Build the file
- run: tinygo build -o locusts ./include
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
diff --git a/Dockerfile b/Dockerfile
index 6b834ff..d97cf15 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,8 +1,15 @@
+FROM --platform=$BUILDPLATFORM tinygo/tinygo:0.33.0 AS build
+ARG TARGETOS
+ARG TARGETARCH
+WORKDIR /app
+COPY . .
+RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOFLAGS=-buildvcs=false tinygo build -o locusts ./include
+
FROM scratch
LABEL org.opencontainers.image.licenses=0BSD
LABEL org.opencontainers.image.source=https://github.com/locusts-r-us/locusts
LABEL org.opencontainers.image.title=Locusts
LABEL org.opencontainers.image.description="A container that contains locusts"
HEALTHCHECK NONE
-COPY locusts /
-ENTRYPOINT ["/locusts"] \ No newline at end of file
+COPY --from=build /app/locusts /
+ENTRYPOINT ["/locusts"]