-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove need for modifying dockerfiles each release (#504)
release 2.7.4
- Loading branch information
Showing
16 changed files
with
150 additions
and
25 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FROM node:21.7.1-alpine AS node | ||
|
||
ARG BUILD_VERSION | ||
ARG BUILD_TIME | ||
ARG BUILD_HASH | ||
|
||
LABEL author="Björn 'Idrinth' Büttner" | ||
LABEL maintainer="[email protected]" | ||
LABEL org.label-schema.name="idrinth/api-bench/build" | ||
LABEL org.label-schema.description="An image building the @idrinth/api-bench packages." | ||
LABEL org.label-schema.url="https://idrinth-api-ben.ch" | ||
LABEL org.label-schema.vcs-url="https://github.com/idrinth/api-bench" | ||
LABEL org.label-schema.version=$BUILD_VERSION | ||
LABEL org.label-schema.build-date=$BUILD_TIME | ||
LABEL org.label-schema.vcs-ref=$BUILD_HASH | ||
LABEL org.label-schema.schema-version="1.0" | ||
LABEL org.label-schema.vendor="Björn 'Idrinth' Büttner" | ||
LABEL org.opencontainers.image.created=$BUILD_TIME | ||
LABEL org.opencontainers.image.authors="[email protected]" | ||
LABEL org.opencontainers.image.url="https://idrinth-api-ben.ch" | ||
LABEL org.opencontainers.image.documentation="https://idrinth-api-ben.ch" | ||
LABEL org.opencontainers.image.source="https://github.com/idrinth/api-bench" | ||
LABEL org.opencontainers.image.version=$BUILD_VERSION | ||
LABEL org.opencontainers.image.revision=$BUILD_HASH | ||
LABEL org.opencontainers.image.vendor="Björn 'Idrinth' Büttner" | ||
LABEL org.opencontainers.image.licenses="MIT" | ||
LABEL org.opencontainers.image.title="idrinth/api-bench/build" | ||
LABEL org.opencontainers.image.description="An image building the @idrinth/api-bench packages." | ||
|
||
ENV IDRINTH_API_BENCH_VERSION=$BUILD_VERSION | ||
ENV IDRINTH_API_BENCH_BUILT=$BUILD_TIME | ||
|
||
RUN npm install -g --omit=dev "@idrinth/api-bench@${BUILD_VERSION}" \ | ||
&& rm /usr/local/lib/node_modules/@idrinth/api-bench/**/*.ts \ | ||
&& rm /usr/local/lib/node_modules/@idrinth/api-bench/README.md \ | ||
&& rm /usr/local/lib/node_modules/@idrinth/api-bench/index.ts \ | ||
&& rm /usr/local/lib/node_modules/@idrinth/api-bench/tsconfig.json \ | ||
&& rm -r /usr/local/lib/node_modules/@idrinth/api-bench/typings \ | ||
&& (rm -r /usr/local/lib/node_modules/@idrinth/api-bench/integration || true) |
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 @@ | ||
# @idrinth/api-bench build on alpine | ||
|
||
This image builds api-bench on alpine and is mostly for internal usage. | ||
|
||
## Tags | ||
|
||
There are four groups of tags | ||
|
||
- Single number `2` is the latest of that major version | ||
- Single number `2.6` is the latest of that feature version | ||
- Triple number `2.6.1` is the exact version | ||
- `latest` is the latest minor version |
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
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
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 |
---|---|---|
|
@@ -10,3 +10,4 @@ | |
/tools | ||
/result.html | ||
/.markdownlint.yaml | ||
/integration |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,55 @@ | ||
import { | ||
rmSync, | ||
writeFileSync, | ||
} from 'fs'; | ||
import exec from './src/exec.js'; | ||
import readline from 'readline'; | ||
import { | ||
EXIT_SUCCESS, | ||
} from './src/constants.js'; | ||
|
||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
},); | ||
rl.question('Versions(space separated): ', (versions,) => { | ||
rl.question('Docker password: ', (password,) => { | ||
writeFileSync('./pw', password,); | ||
exec('cat pw | docker login -u idrinth --password-stdin', true,); | ||
rmSync('./pw',); | ||
for (const image of [ | ||
'api-bench-build', | ||
'api-bench', | ||
'api-bench-gitea-action', | ||
'api-bench-gitlab-runner', | ||
]) { | ||
for (const version of versions.split(' ',)) { | ||
if (version && version.match(/^\d+\.\d+\.\d+$/u,)) { | ||
const main = version.replace(/\..+$/u, '',); | ||
const feature = version.replace(/\.[^.]+$/u, '',); | ||
const args = [ | ||
`--build-arg="BUILD_VERSION=${ version }"`, | ||
`--build-arg="BUILD_TIME=${ new Date().toISOString() }"`, | ||
`--build-arg="BUILD_HASH=${ exec('git rev-parse --short HEAD',) }"`, | ||
]; | ||
const tags = [ | ||
`-t idrinth/${ image }:latest`, | ||
`-t idrinth/${ image }:${ version }`, | ||
`-t idrinth/${ image }:${ feature }`, | ||
`-t idrinth/${ image }:${ main }`, | ||
]; | ||
const params = [ | ||
...args, | ||
...tags, | ||
]; | ||
exec( | ||
`cd containers/${ image } && docker build ${ params.join(' ',) } .`, | ||
true, | ||
); | ||
} | ||
} | ||
exec(`docker push -a idrinth/${ image }`, true,); | ||
} | ||
process.emit(EXIT_SUCCESS,); | ||
},); | ||
},); |