Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 1 addition & 9 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ jest.config.js
nodemon.json
**/.DS_Store
**/Thumbs.db
ui/src/
ui/public/

ui/tests/
ui/coverage/
ui/node_modules/
ui/package*.json
ui/.eslintrc.js
ui/babel.config.js
ui/jest.config.js
ui/vue.config.js
ui/.browserslistrc
48 changes: 24 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
# Common Stage
FROM node:24-alpine AS base
WORKDIR /home/node/app

# App dependency stage
FROM base AS app-dependencies
COPY app/package* ./
RUN npm ci --omit=dev --omit=optional --no-audit --no-fund --no-update-notifier

# UI stage - building UI assets
FROM base AS ui-dependencies
COPY ./ui ./
RUN pwd && tree .
RUN npm ci --no-audit --no-fund --no-update-notifier && npm run build

# Release stage
FROM base AS release

LABEL maintainer="fmartinou"
EXPOSE 3000

ARG WUD_VERSION=unknown

ENV WORKDIR=/home/node/app
Expand All @@ -12,36 +26,22 @@ ENV WUD_VERSION=$WUD_VERSION

HEALTHCHECK --interval=30s --timeout=5s CMD if [[ -z ${WUD_SERVER_ENABLED} || ${WUD_SERVER_ENABLED} == 'true' ]]; then curl --fail http://localhost:${WUD_SERVER_PORT:-3000}/health || exit 1; else exit 0; fi;

WORKDIR /home/node/app

# Setup directory structure
RUN mkdir /store

# Add useful stuff
RUN apk add --no-cache tzdata openssl curl git jq bash

# Dependencies stage
FROM base AS dependencies
# RUN apk add --no-cache tzdata openssl curl git jq bash
RUN apk add --no-cache tzdata openssl curl bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git and jq were there for those who use the cmd trigger and could need them.


# Copy app package.json
COPY app/package* ./

# Install dependencies
RUN npm ci --omit=dev --omit=optional --no-audit --no-fund --no-update-notifier

# Release stage
FROM base AS release

# Default entrypoint
COPY Docker.entrypoint.sh /usr/bin/entrypoint.sh
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
CMD ["node", "index"]

## Copy node_modules
COPY --from=dependencies /home/node/app/node_modules ./node_modules
## Copy dependencies and artifacts
COPY --from=app-dependencies /home/node/app/node_modules ./node_modules
COPY --from=ui-dependencies /home/node/app/dist/ ./ui

# Copy app
# Copy app source
COPY app/ ./

# Copy ui
COPY ui/dist/ ./ui
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
CMD ["node", "index"]
4 changes: 2 additions & 2 deletions app/registries/providers/trueforge/trueforge.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const trueforge = require('./trueforge');
const Trueforge = require('./trueforge');

jest.mock('axios', () =>
jest.fn().mockImplementation(() => ({
data: { token: 'xxxxx' },
})),
);

const trueforge = new trueforge();
const trueforge = new Trueforge();
trueforge.configuration = {
username: 'user',
token: 'token',
Expand Down
35 changes: 23 additions & 12 deletions app/watchers/providers/docker/Docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function getTagCandidates(container, tags, logContainer) {
);

// Remove prefix and suffix (keep only digits and dots)
const numericPart = container.image.tag.semver.match(/(\d+(\.\d+)*)/);
const numericPart = container.image.tag.value.match(/(\d+(\.\d+)*)/);

if (numericPart) {
const referenceGroups = numericPart[0].split('.').length;
Expand Down Expand Up @@ -158,7 +158,7 @@ function getTagCandidates(container, tags, logContainer) {
// Non semver tag -> do not propose any other registry tag
filteredTags = [];
}
throw new Error(`Tag is Neither Semver or not-Semver ${container.image.tag.value}`);
return filteredTags;
}

function normalizeContainer(container) {
Expand Down Expand Up @@ -270,22 +270,32 @@ function isContainerToWatch(wudWatchLabelValue, watchByDefault) {
* @param {object} parsedImage - object containing at least `domain` property
* @returns {boolean}
*/
function isDigestToWatch(wudWatchDigestLabelValue, parsedImage) {
let result = true;
function isDigestToWatch(wudWatchDigestLabelValue, parsedImage, isSemver) {
const domain = parsedImage.domain;
const isDockerHub =
!domain ||
domain === '' ||
domain === 'docker.io' ||
domain.endsWith('.docker.io');

if (
parsedImage.domain === "docker.io" ||
parsedImage.domain === "registry-1.docker.io" ||
parsedImage.domain === ''
wudWatchDigestLabelValue !== undefined &&
wudWatchDigestLabelValue !== ''
) {
result = false;
const shouldWatch = wudWatchDigestLabelValue.toLowerCase() === 'true';
if (shouldWatch && isDockerHub) {
log.warn(
`Watching digest for image ${parsedImage.path} with domain ${domain} may result in throttled requests`,
);
}
return shouldWatch;
}

if (wudWatchDigestLabelValue) {
result = wudWatchDigestLabelValue.toLowerCase() === 'true';
if (isSemver) {
return false;
}

return result;
return !isDockerHub;
}


Expand Down Expand Up @@ -806,7 +816,8 @@ class Docker extends Component {
const isSemver = parsedTag !== null && parsedTag !== undefined;
const watchDigest = isDigestToWatch(
container.Labels[wudWatchDigest],
parsedImage.domain,
parsedImage,
isSemver,
);
if (!isSemver && !watchDigest) {
this.ensureLogger();
Expand Down
Loading