-
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.
Signed-off-by: Sebastian Davids <[email protected]>
- Loading branch information
Showing
32 changed files
with
1,172 additions
and
0 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 |
---|---|---|
|
@@ -57,6 +57,13 @@ jobs: | |
- go/http/go.mod | ||
- go/http/go.sum | ||
- 'go/http/**.go' | ||
go-https-Dockerfile: | ||
- .hadolint.yaml | ||
- go/https/Dockerfile | ||
go-https: | ||
- go/https/go.mod | ||
- go/https/go.sum | ||
- 'go/https/**.go' | ||
rust-http-Dockerfile: | ||
- .hadolint.yaml | ||
- rust/http/Dockerfile | ||
|
@@ -135,6 +142,34 @@ jobs: | |
name: Build go/http | ||
working-directory: go/http | ||
run: scripts/build_release.sh | ||
# --- go/https ---------------------------------------------------------- | ||
- if: steps.changes.outputs.go-https-Dockerfile == 'true' | ||
name: Lint go/https/Dockerfile | ||
# https://github.com/hadolint/hadolint-action/releases | ||
uses: hadolint/[email protected] | ||
with: | ||
dockerfile: go/https/Dockerfile | ||
- if: steps.changes.outputs.go-https == 'true' | ||
name: Install Go for go/https | ||
# https://github.com/actions/setup-go/releases | ||
uses: actions/[email protected] | ||
with: | ||
go-version-file: go/https/go.mod | ||
- if: steps.changes.outputs.go-https == 'true' | ||
name: Lint go/https files | ||
# https://github.com/golangci/golangci-lint-action/releases | ||
uses: golangci/[email protected] | ||
with: | ||
version: v1.61.0 | ||
working-directory: go/https | ||
- if: steps.changes.outputs.go-https == 'true' | ||
name: Test go/https | ||
working-directory: go/https | ||
run: scripts/test.sh | ||
- if: steps.changes.outputs.go-https == 'true' | ||
name: Build go/https | ||
working-directory: go/https | ||
run: scripts/build_release.sh | ||
# --- rust/http ------------------------------------------------------ | ||
- if: steps.changes.outputs.rust-http-Dockerfile == 'true' | ||
name: Lint rust/http Dockerfile | ||
|
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-FileCopyrightText: © 2024 Sebastian Davids <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# https://docs.docker.com/build/building/context/#dockerignore-files | ||
|
||
*.adoc | ||
*.swp | ||
.DS_Store | ||
Dockerfile | ||
Thumbs.db | ||
desktop.ini | ||
scripts/ |
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# SPDX-FileCopyrightText: © 2024 Sebastian Davids <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# https://docs.docker.com/engine/reference/builder/ | ||
|
||
### healthcheck builder ### | ||
|
||
# https://hub.docker.com/_/golang/ | ||
FROM golang:1.23.2-alpine3.20 AS healthcheck | ||
|
||
WORKDIR /app | ||
|
||
COPY go.sum go.mod ./ | ||
|
||
RUN go mod download | ||
|
||
COPY cmd cmd | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags '-s -w' -o target/healthcheck cmd/healthcheck.go | ||
|
||
LABEL de.sdavids.docker.group="sdavids-docker-healthcheck" \ | ||
de.sdavids.docker.type="builder" | ||
|
||
### HTTPS server ### | ||
|
||
# https://hub.docker.com/_/nginx/ | ||
FROM nginx:1.27.2-alpine3.20-slim AS https_server | ||
|
||
RUN mkdir -p /usr/share/nginx/html/-/health && \ | ||
touch /usr/share/nginx/html/-/health/liveness && \ | ||
printf '<!doctype html><title>sdavids-docker-healthcheck-go-https</title><h1>sdavids-docker-healthcheck-go-https</h1>' > /usr/share/nginx/html/index.html && \ | ||
printf 'server {listen 3000 ssl;listen [::]:3000 ssl;ssl_certificate /etc/ssl/certs/server.crt;ssl_certificate_key /etc/ssl/private/server.key;location / {root /usr/share/nginx/html;index index.html;}}' > /etc/nginx/conf.d/default.conf | ||
|
||
LABEL de.sdavids.docker.group="sdavids-docker-healthcheck" \ | ||
de.sdavids.docker.type="builder" | ||
|
||
### final ### | ||
|
||
FROM https_server | ||
|
||
EXPOSE 3000 | ||
|
||
COPY --from=healthcheck \ | ||
/app/target/healthcheck \ | ||
/usr/local/bin/healthcheck | ||
|
||
HEALTHCHECK --interval=5s --timeout=5s --start-period=5s \ | ||
CMD healthcheck || exit 1 | ||
|
||
# https://github.com/opencontainers/image-spec/blob/master/annotations.md | ||
LABEL org.opencontainers.image.licenses="Apache-2.0" \ | ||
org.opencontainers.image.vendor="Sebastian Davids" \ | ||
org.opencontainers.image.title="healthcheck-go-https" \ | ||
de.sdavids.docker.group="sdavids-docker-healthcheck" \ | ||
de.sdavids.docker.type="development" |
Oops, something went wrong.