Skip to content

Commit

Permalink
setting :: 배포 및 환경변수 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaisqls committed Jan 9, 2024
1 parent 8635fc7 commit bd46189
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 430 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/xquare-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Xquare Deployment

on:
push:
branches: [ main ]

jobs:
CD:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18

- name: Deploy to xquare
uses: team-xquare/xquare-deployment-action@master
with:
environment: prod
github_token: ${{ secrets.PAT }}
access_key: ${{ secrets.ACCESS_KEY }}
buildargs: |
LOKI_URL=${{ secrets.LOKI_URL }}
PROMETHEUS_URL=${{ secrets.PROMETHEUS_URL }}
6 changes: 6 additions & 0 deletions .xquare/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
config:
name: dashboard-tsdata-bridge
service_type: be
port: 8080
domain:
prod: tsdata.xquare.app
36 changes: 18 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# syntax=docker/dockerfile:1

ARG BASE_IMAGE=alpine:3.18.3
ARG GO_IMAGE=golang:1.21.5-alpine3.18

ARG GO_SRC=go-builder
ARG JS_SRC=js-builder

FROM --platform=${JS_PLATFORM} ${JS_IMAGE} as js-builder

FROM ${GO_IMAGE} as go-builder

ARG GO_BUILD_TAGS="oss"
ARG WIRE_TAGS="oss"
ARG BINGO="true"

WORKDIR /tmp/grafana
WORKDIR /tmp/dashboard-tsdata-bridge

COPY go.* ./
COPY .bingo .bingo

RUN go mod download

COPY Makefile build.go package.json ./
COPY Makefile main.go ./
COPY pkg pkg

RUN make build WIRE_TAGS=${WIRE_TAGS}
RUN go mod tidy \
&& go get -u -d -v ./...
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-s -w' -o project

RUN apt update && apt install -y make
RUN make gen-go
RUN make build

EXPOSE 3000
FROM scratch
COPY --from=builder /tmp/dashboard-tsdata-bridge /

ARG RUN_SH=./packaging/docker/run.sh
COPY ${RUN_SH} /run.sh
ARG LOKI_URL
ENV LOKI_URL ${LOKI_URL}
ARG PROMETHEUS_URL
ENV PROMETHEUS_URL ${PROMETHEUS_URL}

ENTRYPOINT [ "/run.sh" ]
EXPOSE 9090
CMD ["/project"]
18 changes: 3 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,10 @@ targets := $(shell echo '$(sources)' | tr "," " ")
$(NGALERT_SPEC_TARGET):
+$(MAKE) -C pkg/services/ngalert/api/tooling api.json

gen-go: $(WIRE)
gen: $(WIRE)
@echo "generate go files"
$(WIRE) gen -tags $(WIRE_TAGS) ./pkg/server

build-go: ## Build all Go binaries.
build: ## Build all Go binaries.
@echo "build go files"
$(GO) run build.go $(GO_BUILD_FLAGS) build

run: $(BRA) ## Build and run web server on filesystem changes.
$(BRA) run

##@ Linting
golangci-lint: $(GOLANGCI_LINT)
@echo "lint via golangci-lint"
$(GOLANGCI_LINT) run \
--config .golangci.toml \
$(GO_FILES)

lint-go: golangci-lint ## Run all code checks for backend. You can use GO_FILES to specify exact files to check
$(GO) build -o project $(GO_BUILD_FLAGS)
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ require (
github.com/unknwon/com v1.0.1 // indirect
github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3 // indirect
github.com/urfave/cli v1.22.14 // indirect
github.com/urfave/cli/v2 v2.27.1 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/yalue/merged_fs v1.2.2 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,7 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk=
github.com/urfave/cli v1.22.14/go.mod h1:X0eDS6pD6Exaclxm99NJ3FiCDRED7vIHpx2mDOHLvkA=
github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho=
github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/yalue/merged_fs v1.2.2 h1:vXHTpJBluJryju7BBpytr3PDIkzsPMpiEknxVGPhN/I=
github.com/yalue/merged_fs v1.2.2/go.mod h1:WqqchfVYQyclV2tnR7wtRhBddzBvLVR83Cjw9BKQw0M=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
File renamed without changes.
105 changes: 0 additions & 105 deletions packaging/docker/README.md

This file was deleted.

113 changes: 0 additions & 113 deletions packaging/docker/build.sh

This file was deleted.

33 changes: 0 additions & 33 deletions packaging/docker/custom/Dockerfile

This file was deleted.

Loading

0 comments on commit bd46189

Please sign in to comment.