Skip to content

Commit

Permalink
🔀 Merge pull request gchq#457 from Lissy93/ARCH/docker-multi-arch
Browse files Browse the repository at this point in the history
[ARCH] Multi-architecture Docker image
  • Loading branch information
Lissy93 committed Jan 29, 2022
2 parents 31a3e65 + aa1dc7b commit 31702a6
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/Dockerfile-multi-arch
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true

- name: 💬 Set Docker Hub Description
uses: peter-evans/dockerhub-description@v2
with:
repository: lissy93/dashy
readme-filepath: ./README.md
short-description: Dashy - A self-hosted start page for your server
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# - name: 💬 Set Docker Hub Description
# uses: peter-evans/dockerhub-description@v2
# with:
# repository: lissy93/dashy
# readme-filepath: ./README.md
# short-description: Dashy - A self-hosted start page for your server
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
40 changes: 0 additions & 40 deletions .github/workflows/docker-release.yml

This file was deleted.

48 changes: 34 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
FROM node:lts-alpine3.14
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

# Install app dependencies
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

# Build the final image
FROM node:14.17.5-alpine

# Define some ENV Vars
ENV PORT=80 \
Expand All @@ -8,24 +34,18 @@ ENV PORT=80 \
# Create and set the working directory
WORKDIR ${DIRECTORY}

# Copy over both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./
COPY yarn.lock ./
# Install tini for initialization and tzdata for setting timezone
RUN apk add --no-cache tzdata tini

# Install project dependencies
RUN yarn
# Copy built application from build phase
COPY --from=BUILD_IMAGE /app ./

# Copy over all project files and folders to the working directory
COPY . .

# Build initial app for production
RUN yarn build
# Finally, run start command to serve up the built application
ENTRYPOINT [ "/sbin/tini", "--" ]
CMD [ "yarn", "build-and-start" ]

# 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

0 comments on commit 31702a6

Please sign in to comment.