Skip to content

Commit

Permalink
chore: remove useless index creation flow
Browse files Browse the repository at this point in the history
  • Loading branch information
luigibarbato committed Jan 22, 2024
1 parent f70ca76 commit 09c1cbe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
20 changes: 2 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG GO_VERSION=1.21

FROM alpine:${ALPINE_VERSION} AS certificator
RUN apk --update add --no-cache ca-certificates openssl git tzdata && \
update-ca-certificates
update-ca-certificates

FROM golang:${GO_VERSION}-alpine AS builder
WORKDIR /app
Expand All @@ -21,25 +21,9 @@ ENV UNCONDITIONAL_API_BUILD_RELEASE_VERSION=${UNCONDITIONAL_API_BUILD_RELEASE_VE

RUN go build --ldflags "-X 'main.releaseVersion=${UNCONDITIONAL_API_BUILD_RELEASE_VERSION}' -X 'main.gitCommit=${UNCONDITIONAL_API_BUILD_COMMIT_VERSION}'" --tags=release -o main .

FROM builder as data
WORKDIR /data
COPY --from=builder /app/main /app/main

ARG UNCONDITIONAL_API_SOURCE_REPO
ARG UNCONDITIONAL_API_LOG_ENV
ENV UNCONDITIONAL_API_SOURCE_REPO=${UNCONDITIONAL_API_SOURCE_REPO}
ENV UNCONDITIONAL_API_LOG_ENV=${UNCONDITIONAL_API_LOG_ENV}

RUN --mount=type=secret,id=UNCONDITIONAL_API_SOURCE_CLIENT_KEY \
UNCONDITIONAL_API_SOURCE_CLIENT_KEY="$(cat /run/secrets/UNCONDITIONAL_API_SOURCE_CLIENT_KEY)" \
/app/main source download --path /data/source.json

RUN /app/main index create --source /data/source.json --name /data/index

FROM scratch as release
COPY --from=certificator /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app/main /app/main
COPY --from=data /data /data

ARG UNCONDITIONAL_API_ADDRESS
ARG UNCONDITIONAL_API_ALLOWED_ORIGINS
Expand All @@ -55,4 +39,4 @@ ENV UNCONDITIONAL_API_SOURCE_REPO=${UNCONDITIONAL_API_SOURCE_REPO}
ENV UNCONDITIONAL_API_SOURCE_CLIENT_KEY=${UNCONDITIONAL_API_SOURCE_CLIENT_KEY}
ENV UNCONDITIONAL_API_LOG_ENV=${UNCONDITIONAL_API_LOG_ENV}

ENTRYPOINT ["./app/main","serve", "--address", "0.0.0.0", "--port","8080", "--index","/data/index"]
ENTRYPOINT ["./app/main","serve", "--address", "0.0.0.0", "--port","8080"]
1 change: 0 additions & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ func NewServeCommand(version version.Build) *cobra.Command {

cmd.Flags().StringP("address", "a", "localhost", "Server address")
cmd.Flags().IntP("port", "p", 8080, "Server port")
cmd.Flags().StringP("index", "s", "", "Index path")
cmd.Flags().String("allowed-origins", "", "Allowed Origins")
cmd.Flags().String("source-repo", "", "Source Repository")
cmd.Flags().String("source-client-key", "", "Source Client Key")
Expand Down

0 comments on commit 09c1cbe

Please sign in to comment.