Fix/ci kontin no internet vaatimus (#34)
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 22s
CI Main / Check existing artifact (push) Successful in 18s
acc-tests Cucumber test report
unit-tests Bats test report
CI Main / Cucumber tests (push) Successful in 1m25s
CI Main / Bats tests (push) Successful in 1m26s
ci-docker-build-push Docker build & push 0.2.19 OK
CI Main / Build & Push Docker (push) Successful in 47s
CI Main / Report Summary (push) Successful in 6s
CI Main / Move provider version tag (push) Successful in 16s
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 22s
CI Main / Check existing artifact (push) Successful in 18s
acc-tests Cucumber test report
unit-tests Bats test report
CI Main / Cucumber tests (push) Successful in 1m25s
CI Main / Bats tests (push) Successful in 1m26s
ci-docker-build-push Docker build & push 0.2.19 OK
CI Main / Build & Push Docker (push) Successful in 47s
CI Main / Report Summary (push) Successful in 6s
CI Main / Move provider version tag (push) Successful in 16s
Co-authored-by: moilanik <niko.moilanen@tietoevry.com> Reviewed-on: #34
This commit was merged in pull request #34.
This commit is contained in:
@@ -2,6 +2,93 @@
|
||||
|
||||
Mallipohjat, esimerkit ja konfiguraatiot. Katso säännöt `SKILL.md`:stä.
|
||||
|
||||
## Pre-cache-esimerkit (Offline Container)
|
||||
|
||||
Alla Dockerfile-esimerkit kielikohtaisista pre-cacheista. Kaikki ajetaan
|
||||
build-vaiheessa — kontti on täysin itseriittoinen eikä lataa mitään
|
||||
pipeline- tai runtime-vaiheessa.
|
||||
|
||||
### Go
|
||||
|
||||
```dockerfile
|
||||
FROM golang:1.24-alpine AS deps
|
||||
WORKDIR /build
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
FROM deps AS test-build
|
||||
COPY . .
|
||||
RUN go test -c -o /tmp/test.bin ./...
|
||||
|
||||
FROM alpine:3.21
|
||||
RUN apk add --no-cache git nodejs
|
||||
COPY --from=deps /go/pkg/mod /go/pkg/mod
|
||||
COPY --from=test-build /tmp/test.bin /usr/local/bin/test
|
||||
```
|
||||
|
||||
### Node.js
|
||||
|
||||
```dockerfile
|
||||
FROM node:22-alpine AS deps
|
||||
WORKDIR /build
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
FROM node:22-alpine
|
||||
RUN apk add --no-cache git
|
||||
COPY --from=deps /build/node_modules /app/node_modules
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
```
|
||||
|
||||
### Java / Maven
|
||||
|
||||
```dockerfile
|
||||
FROM maven:3.9-eclipse-temurin-21 AS deps
|
||||
WORKDIR /build
|
||||
COPY pom.xml ./
|
||||
RUN mvn dependency:go-offline -B
|
||||
|
||||
FROM maven:3.9-eclipse-temurin-21 AS build
|
||||
COPY --from=deps /root/.m2 /root/.m2
|
||||
COPY . .
|
||||
RUN mvn package -B -DskipTests
|
||||
|
||||
FROM eclipse-temurin:21-jre
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=build /build/target/*.jar /app/app.jar
|
||||
WORKDIR /app
|
||||
```
|
||||
|
||||
### Python
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.12-alpine AS deps
|
||||
WORKDIR /build
|
||||
COPY requirements.txt ./
|
||||
RUN pip wheel --wheel-dir=/wheels -r requirements.txt
|
||||
|
||||
FROM python:3.12-alpine
|
||||
RUN apk add --no-cache git
|
||||
COPY --from=deps /build/wheels /wheels
|
||||
COPY --from=deps /build/requirements.txt /
|
||||
RUN pip install --no-index --find-links=/wheels -r /requirements.txt && rm -rf /wheels
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
```
|
||||
|
||||
### Helm + Node.js (korvaa helm-build-push.yml:n runtime-apk)
|
||||
|
||||
```dockerfile
|
||||
FROM alpine/helm:3.16.0 AS helm-bin
|
||||
FROM node:22-alpine
|
||||
RUN apk add --no-cache git
|
||||
COPY --from=helm-bin /usr/bin/helm /usr/local/bin/helm
|
||||
```
|
||||
|
||||
Tämä kontti korvaa `helm-build-push.yml`:n `alpine/helm:3.19.0`-image-riippuvuuden
|
||||
ja poistaa tarpeen asentaa node.js runtime-vaiheessa.
|
||||
|
||||
## Reititin — täydellinen esimerkki
|
||||
|
||||
```yaml
|
||||
|
||||
Reference in New Issue
Block a user