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
2 changes: 1 addition & 1 deletion browser-tests/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
container_name: browser-tests-core-front
build:
context: ..
dockerfile: dev-deploy/Dockerfile
dockerfile: dev-deploy/local.Dockerfile
depends_on:
browser-tests-core-back-imposter:
condition: service_healthy
Expand Down
3 changes: 3 additions & 0 deletions deploy/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Conditions:
UseCanaryDeployment: !Or
- !Condition IsNotDevelopment
- !Equals [ !Ref Environment, dev-canary ]
EnableSpotArmInstance: !Equals [!Ref Environment, dev]

# The AWS Account Id is used in the following mapping section because we have
# multiple developer environments and it is undesirable to have to keep this
Expand Down Expand Up @@ -867,6 +868,8 @@ Resources:
NetworkMode: awsvpc
RequiresCompatibilities:
- FARGATE
RuntimePlatform:
CpuArchitecture: !If [EnableSpotArmInstance, "ARM64", "X86_64"]
TaskRoleArn: !GetAtt ECSTaskRole.Arn

ECSTaskExecutionRole:
Expand Down
12 changes: 7 additions & 5 deletions dev-deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.11.1-alpine3.19@sha256:f4c96a28c0b2d8981664e03f461c2677152cd9a756012ffa8e2c6727427c2bda AS builder
FROM --platform="linux/arm64" arm64v8/node@sha256:b16c4e21f9e9e4d02c226d7b2dde3283fc9315104b66009af546b50f5c7acad4 AS builder
WORKDIR /app

# Install packages
Expand All @@ -21,11 +21,13 @@ RUN npm run tsc
# 'npm install --omit=dev' does not prune test packages which are necessary
RUN npm install --omit=dev

FROM node:20.11.1-alpine3.19@sha256:f4c96a28c0b2d8981664e03f461c2677152cd9a756012ffa8e2c6727427c2bda AS final
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
FROM --platform="linux/arm64" arm64v8/node@sha256:b16c4e21f9e9e4d02c226d7b2dde3283fc9315104b66009af546b50f5c7acad4 as final
#RUN addgroup -S appgroup && adduser -S appuser -G appgroup


RUN ["apt-get", "update"]
RUN ["apt-get", "install", "-y", "tini"]

RUN ["apk", "--no-cache", "upgrade"]
RUN ["apk", "add", "--no-cache", "tini", "curl"]
USER appuser:appgroup

WORKDIR /app
Expand Down
48 changes: 48 additions & 0 deletions dev-deploy/local.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM node:20.11.1-alpine3.19@sha256:f4c96a28c0b2d8981664e03f461c2677152cd9a756012ffa8e2c6727427c2bda AS builder
WORKDIR /app

# Install packages
COPY package.json ./
COPY package-lock.json ./
COPY .npmrc ./
RUN npm install

# Build assets
COPY /assets ./assets
RUN npm run build

# Build code
COPY /src ./src
COPY /locales ./locales
COPY /views ./views
COPY tsconfig.json ./
RUN npm run tsc

# 'npm install --omit=dev' does not prune test packages which are necessary
RUN npm install --omit=dev

FROM node:20.11.1-alpine3.19@sha256:f4c96a28c0b2d8981664e03f461c2677152cd9a756012ffa8e2c6727427c2bda AS final
RUN addgroup -S appgroup && adduser -S appuser -G appgroup

RUN ["apk", "--no-cache", "upgrade"]
RUN ["apk", "add", "--no-cache", "tini", "curl"]
USER appuser:appgroup

WORKDIR /app
# Copy in compile assets and deps from build container
COPY --chown=appuser:appgroup --from=builder /app/node_modules ./node_modules
COPY --chown=appuser:appgroup --from=builder /app/dist ./dist
COPY --chown=appuser:appgroup --from=builder /app/build ./build
COPY --chown=appuser:appgroup --from=builder /app/locales ./locales
COPY --chown=appuser:appgroup --from=builder /app/views ./views
COPY --chown=appuser:appgroup --from=builder /app/package.json ./
COPY --chown=appuser:appgroup --from=builder /app/package-lock.json ./

ENV PORT=8080

HEALTHCHECK --interval=5s --timeout=2s --retries=10 \
CMD curl -f http://localhost:8080/healthcheck || exit 1

EXPOSE 8080

ENTRYPOINT ["sh", "-c", "export DT_HOST_ID=CORE-FRONT-$RANDOM && tini npm start"]