-
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.
Bytt til multistage dockerfile med distroless image for å fjerne sårb…
…arheter
- Loading branch information
Showing
21 changed files
with
252 additions
and
252 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 |
---|---|---|
@@ -1,7 +1,46 @@ | ||
FROM node:20-alpine | ||
FROM node:20-alpine as node | ||
RUN --mount=type=secret,id=NODE_AUTH_TOKEN \ | ||
npm config set //npm.pkg.github.com/:_authToken=$(cat /run/secrets/NODE_AUTH_TOKEN) | ||
RUN npm config set @navikt:registry=https://npm.pkg.github.com | ||
|
||
|
||
# build app | ||
FROM node as app-build | ||
WORKDIR /app | ||
|
||
COPY ./app ./app | ||
COPY ./mocks ./mocks | ||
COPY ./graphql ./graphql | ||
COPY ./vite.config.ts ./ | ||
COPY ./package.json ./ | ||
COPY ./package-lock.json ./ | ||
|
||
RUN npm ci --ignore-scripts | ||
RUN npm run build | ||
|
||
|
||
# install dependencies | ||
FROM node as app-dependencies | ||
WORKDIR /app | ||
|
||
COPY build/ build/ | ||
COPY ./package.json ./ | ||
COPY node_modules/ node_modules/ | ||
COPY ./package-lock.json ./ | ||
|
||
RUN npm ci --ignore-scripts --omit dev | ||
|
||
|
||
# runtime | ||
FROM gcr.io/distroless/nodejs20-debian12 as runtime | ||
WORKDIR /app | ||
|
||
ARG NODE_ENV=production | ||
ENV NODE_ENV=${NODE_ENV} | ||
ENV TZ="Europe/Oslo" | ||
EXPOSE 3000 | ||
|
||
COPY ./public ./public/ | ||
COPY ./package.json ./package.json | ||
COPY --from=app-build /app/build/ ./build/ | ||
COPY --from=app-dependencies /app/node_modules ./node_modules | ||
|
||
CMD ["npm", "run" ,"start"] | ||
CMD ["./node_modules/@remix-run/serve/dist/cli.js", "./build/server/index.js"] |
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 |
---|---|---|
@@ -1,21 +1,22 @@ | ||
import { NodeSDK } from "@opentelemetry/sdk-node"; | ||
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc"; | ||
import type { OTLPExporterNodeConfigBase } from "@opentelemetry/otlp-exporter-base"; | ||
import { Resource } from "@opentelemetry/resources"; | ||
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions"; | ||
import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions"; | ||
import { SimpleSpanProcessor } from "@opentelemetry/sdk-trace-node"; | ||
import type { OTLPGRPCExporterConfigNode } from "@opentelemetry/otlp-grpc-exporter-base"; | ||
|
||
const otelConfig = { | ||
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT, | ||
headers: { | ||
"x-sf-service-name": "dp-saksbehandling-frontend", | ||
}, | ||
} as OTLPExporterNodeConfigBase; | ||
} as OTLPGRPCExporterConfigNode; | ||
|
||
const sdk = new NodeSDK({ | ||
resource: new Resource({ | ||
[SemanticResourceAttributes.SERVICE_NAME]: "dp-saksbehandling-frontend", | ||
[ATTR_SERVICE_NAME]: "dp-saksbehandling-frontend", | ||
}), | ||
spanProcessor: new SimpleSpanProcessor(new OTLPTraceExporter(otelConfig)), | ||
spanProcessors: [new SimpleSpanProcessor(new OTLPTraceExporter(otelConfig))], | ||
}); | ||
|
||
sdk.start(); |
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
Oops, something went wrong.