FROM arm32v7/node:latest

# Define some ENV Vars
ENV PORT 80
ENV DIRECTORY /app
ENV IS_DOCKER true

# Create and set the working directory
WORKDIR ${DIRECTORY}

# Copy over both 'package.json' and 'yarn.lock'
COPY package.json ./
COPY yarn.lock ./

# Install dependencies
RUN yarn

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

# Build Dashy for production
RUN yarn build

# Expose users port
EXPOSE ${PORT}

# Finally, run start command to serve up the built application
CMD [ "yarn", "build-and-start"]

# Enable Docker healthcecks, to ensure Dashy is running correctly
HEALTHCHECK --interval=5m --timeout=2s --start-period=30s CMD yarn health-check
