Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6621e26
All-in-One
Janmtbehrens May 15, 2025
e73b947
Dedicated Test-Script & Dev Folder
Janmtbehrens May 19, 2025
e944563
Production Build Support
Janmtbehrens May 20, 2025
aaa4ab7
Prod as default context & small bug fixes
Janmtbehrens May 22, 2025
135fad0
Golang Version Update
Janmtbehrens May 22, 2025
40aa3d8
Bugfixes and Draft PR
Janmtbehrens May 22, 2025
60beafd
Removed old Dockerfiles
Janmtbehrens Jun 2, 2025
86872a9
Dockerfile Linting
Janmtbehrens Jun 3, 2025
35dbc4c
Dependabot compatibility issue fixed
Janmtbehrens Jun 5, 2025
864c678
Merge remote-tracking branch 'upstream/main' into all-in-one
Janmtbehrens Jun 10, 2025
e321d2a
Dependabot compatibility issue fixed
Janmtbehrens Jun 10, 2025
722ed1b
Adjust Workflows #2
Janmtbehrens Jun 12, 2025
5d52f3f
Remove command.sh from some Go Services
Janmtbehrens Jun 16, 2025
bf2a806
Remove command.sh from some Go Services #3
Janmtbehrens Jun 16, 2025
399201e
Merge with main & Workflow check
Janmtbehrens Jun 17, 2025
d6ffe5a
Create unified and standardized continuous integration workflow for e…
Janmtbehrens Jun 17, 2025
4bf6c8a
Create unified and standardized continuous integration workflow for e…
Janmtbehrens Jun 17, 2025
563a0c9
Small fixes, Typos and Standards
Janmtbehrens Jun 17, 2025
dc80e2f
root dir rename to app
Janmtbehrens Jun 19, 2025
371a8b1
Adding a CI Job which executes run-tests.sh for all services
Janmtbehrens Jun 19, 2025
432dbe7
Go Service bugfixes
Janmtbehrens Jun 19, 2025
02efb76
Lint scripts via Shellcheck
Janmtbehrens Jun 23, 2025
e321ded
Undo Lint
Janmtbehrens Jun 24, 2025
3535a37
PR fixes #2
Janmtbehrens Jun 26, 2025
aa34dc9
Additional PR fixes
Janmtbehrens Jun 26, 2025
5523bac
Merge
Janmtbehrens Jul 3, 2025
f10c263
Replaced reference to reusable github actions
Janmtbehrens Jul 3, 2025
65f2086
PR review changes
Janmtbehrens Jul 7, 2025
d55c954
Adding Go Dockertest to run-tests
Janmtbehrens Jul 8, 2025
65461f2
Remove reference to main repository build-service script
Janmtbehrens Jul 8, 2025
7f5be6c
Merge branch 'main' into all-in-one
Janmtbehrens Jul 10, 2025
308a11c
Merge remote-tracking branch 'upstream/main' into all-in-one
Janmtbehrens Jul 10, 2025
14768d8
Merge branch 'all-in-one' of github.com:Janmtbehrens/openslides-searc…
Janmtbehrens Jul 10, 2025
79ba7dd
Revert GitHub Workflow Tests
Janmtbehrens Jul 10, 2025
a3d832d
Go Test bugfix and merges
Janmtbehrens Jul 14, 2025
a81e483
Merge remote-tracking branch 'upstream/main' into all-in-one
Janmtbehrens Jul 15, 2025
4bc67a6
Rename Continuous Tests to Test again as well as other GitHub Workflo…
Janmtbehrens Jul 21, 2025
249c3e5
Merge with main
Janmtbehrens Jul 22, 2025
248457b
Merge branch 'main' into all-in-one
Janmtbehrens Jul 22, 2025
a213438
Merge remote-tracking branch 'upstream/main' into all-in-one
Janmtbehrens Jul 22, 2025
ad08f7f
Merge branch 'all-in-one' of github.com:Janmtbehrens/openslides-searc…
Janmtbehrens Jul 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 59 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,54 +1,90 @@
FROM golang:1.24.1-alpine as base
ARG CONTEXT=prod
ARG GO_IMAGE_VERSION=1.24.3
ARG ALPINE_VERSION=3

FROM golang:${GO_IMAGE_VERSION}-alpine as base
Comment thread
Janmtbehrens marked this conversation as resolved.
Outdated

## Setup
ARG CONTEXT
ARG GO_IMAGE_VERSION
WORKDIR /root/openslides-search-service
ENV ${CONTEXT}=1


RUN apk add git
## Installs
RUN apk add git --no-cache

COPY go.mod go.sum ./
RUN go mod download

COPY cmd cmd
COPY pkg pkg

# Build service in seperate stage.
FROM base as builder
RUN go build -o openslides-search-service cmd/searchd/main.go


# Test build.
FROM base as testing
## External Information
LABEL org.opencontainers.image.title="OpenSlides Search Service"
LABEL org.opencontainers.image.description="The Search Service is a http endpoint where the clients can search for data within Openslides."
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.source="https://github.com/OpenSlides/openslides-search-service"

RUN apk add build-base
EXPOSE 9050

CMD go vet ./... && go test -test.short ./...
## Command
COPY ./dev/command.sh ./
RUN chmod +x command.sh
CMD ["./command.sh"]


# Development build.
FROM base as development
# Development Image
FROM base as dev

RUN ["go", "install", "github.com/githubnemo/CompileDaemon@latest"]
EXPOSE 9050

WORKDIR /root
COPY entrypoint.sh ./
COPY meta/search.yml .
COPY meta/models.yml .

## Command
ENTRYPOINT ["./entrypoint.sh"]

CMD CompileDaemon -log-prefix=false -build="go build -o search-service ./openslides-search-service/cmd/searchd/main.go" -command="./search-service"


# Productive build
FROM alpine:3
# Testing Image
FROM base as tests

RUN apk add build-base --no-cache

LABEL org.opencontainers.image.title="OpenSlides Search Service"
LABEL org.opencontainers.image.description="The Search Service is a http endpoint where the clients can search for data within Openslides."
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.source="https://github.com/OpenSlides/openslides-search-service"




# Production Image
FROM base as builder
RUN go build -o openslides-search-service cmd/searchd/main.go


FROM alpine:3 as prod

ARG CONTEXT

WORKDIR /

COPY entrypoint.sh ./
COPY meta/search.yml .
COPY meta/models.yml .
COPY --from=builder /root/openslides-search-service/openslides-search-service .

## External Information
LABEL org.opencontainers.image.title="OpenSlides Search Service"
LABEL org.opencontainers.image.description="The Search Service is a http endpoint where the clients can search for data within Openslides."
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.source="https://github.com/OpenSlides/openslides-search-service"

EXPOSE 9050
ENTRYPOINT ["./entrypoint.sh"]
CMD exec ./openslides-search-service

## Command
ENV ${CONTEXT}=1
COPY ./dev/command.sh ./
RUN chmod +x command.sh
CMD ["./command.sh"]
ENTRYPOINT ["./entrypoint.sh"]
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
SERVICE=search

build-dev:
docker build . --target development --tag openslides-search-dev
bash ../dev/scripts/makefile/build-service.sh $(SERVICE) dev

build-prod:
bash ../dev/scripts/makefile/build-service.sh $(SERVICE) prod

build-test:
bash ../dev/scripts/makefile/build-service.sh $(SERVICE) tests

run-tests:
docker build . --target testing --tag openslides-search-test
docker run openslides-search-test
bash dev/run-tests.sh

all: gofmt gotest golinter

Expand Down
5 changes: 5 additions & 0 deletions dev/command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

if [ ! -z $dev ]; then CompileDaemon -log-prefix=false -build="go build -o search-service ./openslides-search-service/cmd/searchd/main.go" -command="./search-service"; fi
if [ ! -z $tests ]; then go vet ./... && go test -test.short ./...; fi
if [ ! -z $prod ]; then exec ./openslides-search-service; fi
18 changes: 18 additions & 0 deletions dev/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Executes all tests. Should errors occur, CATCH will be set to 1, causing an erronous exit code.

echo "########################################################################"
echo "###################### Start full system tests #########################"
echo "########################################################################"

IMAGE_TAG=openslides-search-tests
CATCH=0
PERSIST_CONTAINERS=$1

make build-test || CATCH=1
docker run ${IMAGE_TAG} || CATCH=1

if [ -z $PERSIST_CONTAINERS ]; then docker stop $(docker ps -a -q --filter ancestor=${IMAGE_TAG} --format="{{.ID}}") || CATCH=1; fi

exit $CATCH