mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-30 17:15:29 +02:00
🔀 Merge pull request #160 from Lissy93/DOCKER/revert-image
[DOCKER] Update Dockerfiles Fixes #136
This commit is contained in:
commit
6f8ab4a251
54
Dockerfile
54
Dockerfile
@ -1,53 +1,31 @@
|
|||||||
FROM node:14.17.5-alpine AS BUILD_IMAGE
|
FROM node:lts-alpine3.14
|
||||||
|
|
||||||
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
|
# Define some ENV Vars
|
||||||
ENV PORT=80 \
|
ENV PORT=80 \
|
||||||
DIRECTORY=/app \
|
DIRECTORY=/app \
|
||||||
IS_DOCKER=true
|
IS_DOCKER=true
|
||||||
|
|
||||||
# Create and set the working directory
|
# Create and set the working directory
|
||||||
WORKDIR ${DIRECTORY}
|
WORKDIR ${DIRECTORY}
|
||||||
|
|
||||||
# Install tini and tzdata
|
# Copy over both 'package.json' and 'package-lock.json' (if available)
|
||||||
RUN apk add --no-cache tzdata tini
|
COPY package*.json ./
|
||||||
|
COPY yarn.lock ./
|
||||||
|
|
||||||
# copy from build image
|
# Install project dependencies
|
||||||
COPY --from=BUILD_IMAGE /app ./
|
RUN yarn
|
||||||
|
|
||||||
# Finally, run start command to serve up the built application
|
# Copy over all project files and folders to the working directory
|
||||||
ENTRYPOINT [ "/sbin/tini", "--" ]
|
COPY . .
|
||||||
CMD [ "yarn", "build-and-start" ]
|
|
||||||
|
# Build initial app for production
|
||||||
|
RUN yarn build
|
||||||
|
|
||||||
# Expose given port
|
# Expose given port
|
||||||
EXPOSE ${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
|
# 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
|
HEALTHCHECK --interval=5m --timeout=2s --start-period=30s CMD yarn health-check
|
||||||
|
@ -121,10 +121,15 @@ docker run -d \
|
|||||||
--restart=always \
|
--restart=always \
|
||||||
lissy93/dashy:latest
|
lissy93/dashy:latest
|
||||||
```
|
```
|
||||||
|
[](https://hub.docker.com/r/lissy93/dashy)
|
||||||
|
|
||||||
If you prefer to use Docker Compose, [here is an example](./docs/deployment.md#using-docker-compose).
|
If you prefer to use Docker Compose, [here is an example](./docs/deployment.md#using-docker-compose).
|
||||||
|
|
||||||
[](https://hub.docker.com/r/lissy93/dashy)
|
Dashy is also available through GHCR, run: `docker pull ghcr.io/lissy93/dashy`.
|
||||||
|
|
||||||
|
To use Dashy on an system other than `amd64`, then use [one of these tags](https://hub.docker.com/r/lissy93/dashy/tags). There are containers for `arm32-7`, `arm64-v8` and a multi-architecture image.
|
||||||
|
|
||||||
|
The image defaults to `:latest`, but you can instead specify a specific version, e.g. `docker pull lissy93/dashy:release-1.5.0`
|
||||||
|
|
||||||
> Once you've got Dashy running, you can take a look at [App Management Docs](./docs/management.md), for info on using health checks, provisioning assets, configuring web servers, securing your app, logs, performance and more.
|
> Once you've got Dashy running, you can take a look at [App Management Docs](./docs/management.md), for info on using health checks, provisioning assets, configuring web servers, securing your app, logs, performance and more.
|
||||||
|
|
||||||
|
@ -1,25 +1,42 @@
|
|||||||
---
|
---
|
||||||
# Welcome to Dashy! To get started, run `docker compose up`
|
# Welcome to Dashy! To get started, run `docker compose up`
|
||||||
|
# You can configure your container here, by modifying this file
|
||||||
version: "3.8"
|
version: "3.8"
|
||||||
services:
|
services:
|
||||||
dashy:
|
dashy:
|
||||||
|
container_name: Dashy
|
||||||
|
|
||||||
|
# Pull latest image from DockerHub
|
||||||
|
image: lissy93/dashy
|
||||||
|
|
||||||
# To build from source, replace 'image: lissy93/dashy' with 'build: .'
|
# To build from source, replace 'image: lissy93/dashy' with 'build: .'
|
||||||
# build: .
|
# build: .
|
||||||
image: lissy93/dashy
|
|
||||||
container_name: Dashy
|
# Or, to use a Dockerfile for your archtecture, uncomment the following
|
||||||
|
# context: .
|
||||||
|
# dockerfile: ./docker/Dockerfile-arm32v7
|
||||||
|
|
||||||
|
# You can also use an image with a different tag, or pull from a different registry, e.g:
|
||||||
|
# image: ghcr.io/lissy93/dashy or image: lissy93/dashy:arm64v8
|
||||||
|
|
||||||
# Pass in your config file below, by specifying the path on your host machine
|
# Pass in your config file below, by specifying the path on your host machine
|
||||||
# volumes:
|
# volumes:
|
||||||
# - /root/my-config.yml:/app/public/conf.yml
|
# - /root/my-config.yml:/app/public/conf.yml
|
||||||
|
|
||||||
|
# Set port that web service will be served on. Keep container port as 80
|
||||||
ports:
|
ports:
|
||||||
- 4000:80
|
- 4000:80
|
||||||
|
|
||||||
# Set any environmental variables
|
# Set any environmental variables
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
# Specify your user ID and group ID. You can find this by running `id -u` and `id -g`
|
# Specify your user ID and group ID. You can find this by running `id -u` and `id -g`
|
||||||
# - UID=1000
|
# - UID=1000
|
||||||
# - GID=1000
|
# - GID=1000
|
||||||
|
|
||||||
# Specify restart policy
|
# Specify restart policy
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
# Configure healthchecks
|
# Configure healthchecks
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'node', '/app/services/healthcheck']
|
test: ['CMD', 'node', '/app/services/healthcheck']
|
||||||
|
50
docker/Dockerfile-multi-arch
Normal file
50
docker/Dockerfile-multi-arch
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
# 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
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Source: https://github.com/ckulka/docker-multi-arch-example/blob/master/hooks/pre_build
|
|
||||||
# Used to setup QEMU to build arm images on amd64 processors.
|
# Used to setup QEMU to build arm images on amd64 processors.
|
||||||
|
# Source: https://git.io/J0ezo
|
||||||
|
|
||||||
# Register qemu-*-static for all supported processors except the
|
# Register qemu-*-static for all supported processors except the
|
||||||
# current one, but also remove all registered binfmt_misc before
|
# current one, but also remove all registered binfmt_misc before
|
@ -56,19 +56,21 @@ Explanation of the above options:
|
|||||||
- `-v` Specify volumes, to pass data from your host system to the container, in the format of `[host-path]:[container-path]`, you can use this to pass your config file, directory of assets (like icons), custom CSS or web assets (like favicon.ico, manifest.json etc)
|
- `-v` Specify volumes, to pass data from your host system to the container, in the format of `[host-path]:[container-path]`, you can use this to pass your config file, directory of assets (like icons), custom CSS or web assets (like favicon.ico, manifest.json etc)
|
||||||
- `--name` Give your container a human-readable name
|
- `--name` Give your container a human-readable name
|
||||||
- `--restart=always` Spin up the container when the daemon starts, or after it has been stopped
|
- `--restart=always` Spin up the container when the daemon starts, or after it has been stopped
|
||||||
- `lissy93/dashy:latest` This last option is the image the container should be built from, you can also use a specific version, by replacing `:latest` with one of the [tags](https://hub.docker.com/r/lissy93/dashy/tags)
|
- `lissy93/dashy:latest` This last option is the image the container should be built from, you can also use a specific version or architecture type, by replacing `:latest` with one of the [tags](https://hub.docker.com/r/lissy93/dashy/tags)
|
||||||
|
|
||||||
For all available options, and to learn more, see the [Docker Run Docs](https://docs.docker.com/engine/reference/commandline/run/)
|
For all available options, and to learn more, see the [Docker Run Docs](https://docs.docker.com/engine/reference/commandline/run/)
|
||||||
|
|
||||||
If you're deploying Dashy on a modern ARM-based board, such as a Raspberry Pi (2+), then you'll need to use one of Dashy's ARM images. Set the base image + tag to either `lissy93/dashy:arm64v8` or `lissy93/dashy:arm32v7`, depending on your system architecture.
|
Dashy is also available through GHCR: `docker pull ghcr.io/lissy93/dashy:latest`
|
||||||
|
|
||||||
|
If you're deploying Dashy on a modern ARM-based board, such as a Raspberry Pi (2+), then you'll need to use one of Dashy's ARM images. Set the base image + tag to either `lissy93/dashy:arm64v8` or `lissy93/dashy:arm32v7`, depending on your system architecture. You can also use the `multi-arch` image, which should work on all system architectures.
|
||||||
|
|
||||||
|
The image defaults to `:latest`, but you can instead specify a specific version, e.g. `docker pull lissy93/dashy:release-1.5.0`
|
||||||
|
|
||||||
### Using Docker Compose
|
### Using Docker Compose
|
||||||
|
|
||||||
Using Docker Compose can be useful for saving your specific config in files, without having to type out a long run command each time. Save compose config as a YAML file, and then run `docker compose up` (optionally use the `-f` flag to specify file location, if it isn't located at `./docker-compose.yml`).
|
Using Docker Compose can be useful for saving your specific config in files, without having to type out a long run command each time. Save compose config as a YAML file, and then run `docker compose up` (optionally use the `-f` flag to specify file location, if it isn't located at `./docker-compose.yml`). Compose is also useful if you are using clusters, as the format is very similar to stack files, used with Docker Swarm.
|
||||||
|
|
||||||
Compose is also useful if you are using clusters, as the format is very similar to stack files, used with Docker Swarm.
|
The following is a complete example of a [`docker-compose.yml`](https://github.com/Lissy93/dashy/blob/master/docker-compose.yml) for Dashy. Run it as is, or uncomment the additional options you need.
|
||||||
|
|
||||||
The following is a complete example of a `docker-compose.yml` for Dashy. Run it as is, or uncomment the additional options you need.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
---
|
---
|
||||||
@ -100,6 +102,9 @@ services:
|
|||||||
retries: 3
|
retries: 3
|
||||||
start_period: 40s
|
start_period: 40s
|
||||||
```
|
```
|
||||||
|
You can use a different tag, by for example setting `image: lissy93/dashy:arm64v8`, or pull from GHCR instead by setting `image: ghcr.io/lissy93/dashy`.
|
||||||
|
|
||||||
|
If you are building from source, and would like to use one of the [other Dockerfiles](https://github.com/Lissy93/dashy/tree/master/docker), then under `services.dashy` first set `context: .`, then specify the the path to the dockerfile, e.g. `dockerfile: ./docker/Dockerfile-arm32v7`
|
||||||
|
|
||||||
### Build from Source
|
### Build from Source
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user