Skip to content

Commit

Permalink
CDPT-2295 Use alpine docker image - fix snyk vulns. (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
EarthlingDavey authored Jan 30, 2025
1 parent 3ab606f commit a8b1eb1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
FROM node:23-bookworm-slim AS base
FROM node:23-alpine AS base

ENV TZ="Europe/London"
# Set the time-zone.
RUN apk add --no-cache tzdata && \
cp /usr/share/zoneinfo/Europe/London /etc/localtime && \
echo "Europe/London" > /etc/timezone && \
apk del tzdata

RUN apt-get update && \
apt-get -y install -qq \
httrack
# Install HTTrack.
RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk add --update httrack@testing && rm -rf /var/cache/apk/*

COPY conf/node /home/node/app

Expand All @@ -26,6 +30,7 @@ ENV NODE_ENV=development

USER node

CMD []


# Create a production image, from the base image.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ image: Dockerfile Makefile build

# Get inside the spider container
bash:
docker compose exec spider /bin/bash
docker compose exec spider /bin/ash

# Production environment for testing the production builds locally
build-prod:
Expand Down
3 changes: 1 addition & 2 deletions conf/entrypoint/start-node-dev.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/bash
#!/bin/ash

# If there is a command, then run it and exit - used for running custom commands, i.e. CI.
if [ "$1" ]; then
exec "$@"
exit
fi

DOTS="\n \033[0;32m***\033[0m"
Expand Down
6 changes: 5 additions & 1 deletion conf/node/controllers/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,5 +305,9 @@ export const syncErrorPages = async (
source = "static/error-pages",
destination = "error_pages",
) => {
await sync(source, `s3://${bucket}/${destination}`, { del: true });
try {
await sync(source, `s3://${bucket}/${destination}`, { del: true });
} catch (err) {
console.error("Error syncing error pages", err);
}
};
7 changes: 7 additions & 0 deletions conf/node/controllers/schedule.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { parseScheduleString, scheduleFunction } from "./schedule.js";

jest.useFakeTimers();

describe("system timezone", () => {
it("should be be Europe/London", () => {
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
expect(timezone).toBe("Europe/London");
});
});

describe("parseScheduleString", () => {
it("should parse the schedule string into an object", () => {
const scheduleString =
Expand Down

0 comments on commit a8b1eb1

Please sign in to comment.