🚚 Move additional Dockerfiles into sub dir

This commit is contained in:
Alicia Sykes 2021-08-15 11:25:19 +01:00
parent 2eb9b2fe6d
commit 5dedb37279
3 changed files with 139 additions and 0 deletions

43
docker/Dockerfile-arm32v7 Normal file
View File

@ -0,0 +1,43 @@
FROM alpine:3.12 AS builder
# Download QEMU, see https://github.com/docker/hub-feedback/issues/1261
RUN QEMU_URL=https://github.com/balena-io/qemu/releases/download/v5.2.0%2Bbalena4/qemu-5.2.0.balena4-arm.tar.gz \
&& apk add curl && curl -L $QEMU_URL | tar zxvf - -C . --strip-components 1
# Start second (arm32v7) stage
FROM arm32v7/alpine:3.12
# Add QEMU from build stage
COPY --from=builder qemu-arm-static /usr/bin
# Install Node and Yarn
RUN apk add --update --no-cache nodejs npm yarn
# Define some ENV Vars
ENV PORT=80 \
DIRECTORY=/app \
IS_DOCKER=true
# Create and set the working directory
WORKDIR ${DIRECTORY}
# Copy over both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./
# Install project dependencies
RUN yarn
# Copy over all project files and folders to the working directory
COPY . .
# Build initial app for production
RUN yarn build
# Expose given port
EXPOSE ${PORT}
# Finally, run start command to serve up the built application
CMD [ "yarn", "build-and-start"]
# Run simple healthchecks every 5 mins, to check the Dashy's everythings great
HEALTHCHECK --interval=5m --timeout=2s --start-period=30s CMD yarn health-check

43
docker/Dockerfile-arm64v8 Normal file
View File

@ -0,0 +1,43 @@
FROM alpine:3.12 AS builder
# Download QEMU, see https://github.com/docker/hub-feedback/issues/1261
RUN QEMU_URL=https://github.com/balena-io/qemu/releases/download/v5.2.0%2Bbalena4/qemu-5.2.0.balena4-aarch64.tar.gz \
&& apk add curl && curl -L $QEMU_URL | tar zxvf - -C . --strip-components 1
# Start second (arm64v8) stage
FROM arm64v8/alpine:3.12
# Add QEMU from build stage
COPY --from=builder qemu-aarch64-static /usr/bin
# Install Node and Yarn
RUN apk add --update --no-cache nodejs npm yarn
# Define some ENV Vars
ENV PORT=80 \
DIRECTORY=/app \
IS_DOCKER=true
# Create and set the working directory
WORKDIR ${DIRECTORY}
# Copy over both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./
# Install project dependencies
RUN yarn
# Copy over all project files and folders to the working directory
COPY . .
# Build initial app for production
RUN yarn build
# Expose given port
EXPOSE ${PORT}
# Finally, run start command to serve up the built application
CMD [ "yarn", "build-and-start"]
# Run simple healthchecks every 5 mins, to check the Dashy's everythings great
HEALTHCHECK --interval=5m --timeout=2s --start-period=30s CMD yarn health-check

View File

@ -0,0 +1,53 @@
FROM node:14.17.5-alpine AS BUILD_IMAGE
ARG TARGETPLATFORM
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
# Install additional tools needed on arm64 and armv7
RUN \
case "${TARGETPLATFORM}" in \
'linux/arm64') apk add --no-cache python make g++ ;; \
'linux/arm/v7') apk add --no-cache python make g++ ;; \
esac
# Create and set the working directory
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --network-timeout 1000000
# Copy over all project files and folders to the working directory
COPY . ./
# Build initial app for production
RUN yarn build
# # remove development dependencies
# RUN yarn install --production --ignore-scripts --prefer-offline
# Build the final image
FROM node:14.17.5-alpine
# Define some ENV Vars
ENV PORT=80 \
DIRECTORY=/app \
IS_DOCKER=true
# Create and set the working directory
WORKDIR ${DIRECTORY}
# Install tini and tzdata
RUN apk add --no-cache tzdata tini
# copy from build image
COPY --from=BUILD_IMAGE /app ./
# Finally, run start command to serve up the built application
ENTRYPOINT [ "/sbin/tini", "--" ]
CMD [ "yarn", "build-and-start" ]
# Expose given port
EXPOSE ${PORT}
# Run simple healthchecks every 5 mins, to check the Dashy's everythings great
HEALTHCHECK --interval=5m --timeout=2s --start-period=30s CMD yarn health-check