-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: move crossplatform to be handled by go compiler
- Loading branch information
Showing
8 changed files
with
263 additions
and
66 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 |
---|---|---|
@@ -1,13 +1,43 @@ | ||
# Build stage | ||
FROM golang:1.21-alpine AS builder | ||
WORKDIR /sensorbucket | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Install build dependencies | ||
RUN apk add --no-cache git ca-certificates tzdata | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
|
||
# Download dependencies | ||
RUN go mod download | ||
|
||
# Copy the source code | ||
COPY . . | ||
RUN CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -tags timetzdata -o /core services/core/main.go | ||
|
||
# Build the application | ||
ARG TARGETOS=linux | ||
ARG TARGETARCH=amd64 | ||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \ | ||
-ldflags='-w -s -extldflags "-static"' \ | ||
-tags timetzdata \ | ||
-o /core \ | ||
services/core/main.go | ||
|
||
# Final stage | ||
FROM scratch AS production | ||
|
||
WORKDIR / | ||
|
||
# Copy timezone data | ||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo | ||
# Copy CA certificates | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
# Copy the binary from the builder stage | ||
COPY --from=builder /core /core | ||
# Set timezone environment variable | ||
ENV TZ=Etc/UTC | ||
|
||
# Run the binary | ||
ENTRYPOINT ["/core"] |
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 |
---|---|---|
@@ -1,27 +1,51 @@ | ||
FROM golang:1.21-alpine AS dev | ||
WORKDIR /workspace | ||
# Build stage | ||
FROM golang:1.21-alpine AS builder | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
RUN go install github.com/cespare/reflex@latest | ||
RUN go install github.com/valyala/quicktemplate/qtc@latest | ||
RUN go install github.com/evanw/esbuild/cmd/esbuild@latest | ||
RUN apk add make curl | ||
RUN apk add --no-cache git ca-certificates tzdata make curl | ||
RUN curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/download/v3.3.3/tailwindcss-linux-x64 \ | ||
&& chmod +x tailwindcss-linux-x64 \ | ||
&& mv tailwindcss-linux-x64 /usr/bin/tailwind \ | ||
&& ln -s /usr/bin/tailwind /usr/bin/tailwindcss | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
|
||
# Download dependencies | ||
RUN go mod download | ||
|
||
CMD ["make", "watch-dashboard"] | ||
# Copy the source code | ||
COPY . . | ||
|
||
FROM dev AS build | ||
WORKDIR /workspace | ||
RUN make -C services/dashboard build | ||
|
||
COPY . . | ||
RUN GOOS=linux go build -o /app/dashboard ./services/dashboard | ||
# Build the application | ||
ARG TARGETOS=linux | ||
ARG TARGETARCH=amd64 | ||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \ | ||
-ldflags='-w -s -extldflags "-static"' \ | ||
-tags timetzdata \ | ||
-o /dashboard \ | ||
services/dashboard/main.go | ||
|
||
# Final stage | ||
FROM scratch AS production | ||
|
||
WORKDIR / | ||
|
||
# Copy timezone data | ||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo | ||
# Copy CA certificates | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
# Copy the binary from the builder stage | ||
COPY --from=builder /dashboard /dashboard | ||
# Set timezone environment variable | ||
ENV TZ=Etc/UTC | ||
|
||
FROM alpine AS production | ||
COPY --from=build /app/dashboard /app/dashboard | ||
ENTRYPOINT ["/app/dashboard"] | ||
# Run the binary | ||
ENTRYPOINT ["/dashboard"] | ||
|
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 |
---|---|---|
@@ -1,13 +1,43 @@ | ||
# Build stage | ||
FROM golang:1.21-alpine AS builder | ||
WORKDIR /sensorbucket | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Install build dependencies | ||
RUN apk add --no-cache git ca-certificates tzdata | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
|
||
# Download dependencies | ||
RUN go mod download | ||
|
||
# Copy the source code | ||
COPY . . | ||
RUN CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -tags timetzdata -o /fission-rmq-connector services/fission-rmq-connector/main.go | ||
|
||
# Build the application | ||
ARG TARGETOS=linux | ||
ARG TARGETARCH=amd64 | ||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \ | ||
-ldflags='-w -s -extldflags "-static"' \ | ||
-tags timetzdata \ | ||
-o /fission-rmq-connector \ | ||
services/fission-rmq-connector/main.go | ||
|
||
# Final stage | ||
FROM scratch AS production | ||
|
||
WORKDIR / | ||
|
||
# Copy timezone data | ||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo | ||
# Copy CA certificates | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
# Copy the binary from the builder stage | ||
COPY --from=builder /fission-rmq-connector /fission-rmq-connector | ||
# Set timezone environment variable | ||
ENV TZ=Etc/UTC | ||
|
||
# Run the binary | ||
ENTRYPOINT ["/fission-rmq-connector"] |
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 |
---|---|---|
@@ -1,13 +1,43 @@ | ||
# Build stage | ||
FROM golang:1.21-alpine AS builder | ||
WORKDIR /sensorbucket | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Install build dependencies | ||
RUN apk add --no-cache git ca-certificates tzdata | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
|
||
# Download dependencies | ||
RUN go mod download | ||
|
||
# Copy the source code | ||
COPY . . | ||
RUN CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -tags timetzdata -o /user-workers services/fission-user-workers/main.go | ||
|
||
# Build the application | ||
ARG TARGETOS=linux | ||
ARG TARGETARCH=amd64 | ||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \ | ||
-ldflags='-w -s -extldflags "-static"' \ | ||
-tags timetzdata \ | ||
-o /fission-user-workers \ | ||
services/fission-user-workers/main.go | ||
|
||
# Final stage | ||
FROM scratch AS production | ||
COPY --from=builder /user-workers /user-workers | ||
ENTRYPOINT ["/user-workers"] | ||
|
||
WORKDIR / | ||
|
||
# Copy timezone data | ||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo | ||
# Copy CA certificates | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
# Copy the binary from the builder stage | ||
COPY --from=builder /fission-user-workers /fission-user-workers | ||
# Set timezone environment variable | ||
ENV TZ=Etc/UTC | ||
|
||
# Run the binary | ||
ENTRYPOINT ["/fission-user-workers"] |
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 |
---|---|---|
@@ -1,13 +1,43 @@ | ||
# Build stage | ||
FROM golang:1.21-alpine AS builder | ||
WORKDIR /sensorbucket | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Install build dependencies | ||
RUN apk add --no-cache git ca-certificates tzdata | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
|
||
# Download dependencies | ||
RUN go mod download | ||
|
||
# Copy the source code | ||
COPY . . | ||
RUN CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -tags timetzdata -o /httpimporter services/httpimporter/main.go | ||
|
||
# Build the application | ||
ARG TARGETOS=linux | ||
ARG TARGETARCH=amd64 | ||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \ | ||
-ldflags='-w -s -extldflags "-static"' \ | ||
-tags timetzdata \ | ||
-o /httpimporter \ | ||
services/httpimporter/main.go | ||
|
||
# Final stage | ||
FROM scratch AS production | ||
|
||
WORKDIR / | ||
|
||
# Copy timezone data | ||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo | ||
# Copy CA certificates | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
# Copy the binary from the builder stage | ||
COPY --from=builder /httpimporter /httpimporter | ||
# Set timezone environment variable | ||
ENV TZ=Etc/UTC | ||
|
||
# Run the binary | ||
ENTRYPOINT ["/httpimporter"] |
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 |
---|---|---|
@@ -1,27 +1,51 @@ | ||
FROM golang:1.21-alpine AS dev | ||
WORKDIR /workspace | ||
# Build stage | ||
FROM golang:1.21-alpine AS builder | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
RUN go install github.com/cespare/reflex@latest | ||
RUN go install github.com/valyala/quicktemplate/qtc@latest | ||
RUN go install github.com/evanw/esbuild/cmd/esbuild@latest | ||
RUN apk add make curl | ||
RUN apk add --no-cache git ca-certificates tzdata make curl | ||
RUN curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/download/v3.3.3/tailwindcss-linux-x64 \ | ||
&& chmod +x tailwindcss-linux-x64 \ | ||
&& mv tailwindcss-linux-x64 /usr/bin/tailwind \ | ||
&& ln -s /usr/bin/tailwind /usr/bin/tailwindcss | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
|
||
# Download dependencies | ||
RUN go mod download | ||
|
||
CMD ["make", "watch-tenants"] | ||
# Copy the source code | ||
COPY . . | ||
|
||
FROM dev AS build | ||
WORKDIR /workspace | ||
RUN make -C services/tenants build | ||
|
||
COPY . . | ||
RUN GOOS=linux go build -o /app/tenants ./services/tenants | ||
# Build the application | ||
ARG TARGETOS=linux | ||
ARG TARGETARCH=amd64 | ||
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \ | ||
-ldflags='-w -s -extldflags "-static"' \ | ||
-tags timetzdata \ | ||
-o /tenants \ | ||
services/tenants/main.go | ||
|
||
# Final stage | ||
FROM scratch AS production | ||
|
||
WORKDIR / | ||
|
||
# Copy timezone data | ||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo | ||
# Copy CA certificates | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
# Copy the binary from the builder stage | ||
COPY --from=builder /tenants /tenants | ||
# Set timezone environment variable | ||
ENV TZ=Etc/UTC | ||
|
||
FROM alpine AS production | ||
COPY --from=build /app/tenants /app/tenants | ||
ENTRYPOINT ["/app/tenants"] | ||
# Run the binary | ||
ENTRYPOINT ["/tenants"] | ||
|
Oops, something went wrong.