-
Notifications
You must be signed in to change notification settings - Fork 16
Dockerfile Rework #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Dockerfile Rework #243
Changes from 8 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
6621e26
All-in-One
Janmtbehrens e73b947
Dedicated Test-Script & Dev Folder
Janmtbehrens e944563
Production Build Support
Janmtbehrens aaa4ab7
Prod as default context & small bug fixes
Janmtbehrens 135fad0
Golang Version Update
Janmtbehrens 40aa3d8
Bugfixes and Draft PR
Janmtbehrens 60beafd
Removed old Dockerfiles
Janmtbehrens 86872a9
Dockerfile Linting
Janmtbehrens 35dbc4c
Dependabot compatibility issue fixed
Janmtbehrens 864c678
Merge remote-tracking branch 'upstream/main' into all-in-one
Janmtbehrens e321d2a
Dependabot compatibility issue fixed
Janmtbehrens 722ed1b
Adjust Workflows #2
Janmtbehrens 5d52f3f
Remove command.sh from some Go Services
Janmtbehrens bf2a806
Remove command.sh from some Go Services #3
Janmtbehrens 399201e
Merge with main & Workflow check
Janmtbehrens d6ffe5a
Create unified and standardized continuous integration workflow for e…
Janmtbehrens 4bf6c8a
Create unified and standardized continuous integration workflow for e…
Janmtbehrens 563a0c9
Small fixes, Typos and Standards
Janmtbehrens dc80e2f
root dir rename to app
Janmtbehrens 371a8b1
Adding a CI Job which executes run-tests.sh for all services
Janmtbehrens 432dbe7
Go Service bugfixes
Janmtbehrens 02efb76
Lint scripts via Shellcheck
Janmtbehrens e321ded
Undo Lint
Janmtbehrens 3535a37
PR fixes #2
Janmtbehrens aa34dc9
Additional PR fixes
Janmtbehrens 5523bac
Merge
Janmtbehrens f10c263
Replaced reference to reusable github actions
Janmtbehrens 65f2086
PR review changes
Janmtbehrens d55c954
Adding Go Dockertest to run-tests
Janmtbehrens 65461f2
Remove reference to main repository build-service script
Janmtbehrens 7f5be6c
Merge branch 'main' into all-in-one
Janmtbehrens 308a11c
Merge remote-tracking branch 'upstream/main' into all-in-one
Janmtbehrens 14768d8
Merge branch 'all-in-one' of github.com:Janmtbehrens/openslides-searc…
Janmtbehrens 79ba7dd
Revert GitHub Workflow Tests
Janmtbehrens a3d832d
Go Test bugfix and merges
Janmtbehrens a81e483
Merge remote-tracking branch 'upstream/main' into all-in-one
Janmtbehrens 4bc67a6
Rename Continuous Tests to Test again as well as other GitHub Workflo…
Janmtbehrens 249c3e5
Merge with main
Janmtbehrens 248457b
Merge branch 'main' into all-in-one
Janmtbehrens a213438
Merge remote-tracking branch 'upstream/main' into all-in-one
Janmtbehrens ad08f7f
Merge branch 'all-in-one' of github.com:Janmtbehrens/openslides-searc…
Janmtbehrens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,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 | ||
|
|
||
| ## 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"] | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -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 |
This file contains hidden or 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 |
|---|---|---|
| @@ -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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.