lowdefy/packages/servers/serverDocker
2021-08-11 13:15:32 +02:00
..
src chore: Update docker server project config. 2021-08-11 13:15:32 +02:00
.babelrc fix(servers): .babelrc file should not be in .dockerignore 2021-06-09 16:45:20 +02:00
.dockerignore fix(servers): .babelrc file should not be in .dockerignore 2021-06-09 16:45:20 +02:00
CHANGELOG.md chore: Release version 3.19.0. 2021-07-26 09:56:28 +02:00
Dockerfile fix: Remove yarn cache clean from docker builds. 2021-06-09 10:03:53 +02:00
jest.config.js feat(server-docker): add @lowdefy/server-docker package 2020-12-01 14:51:26 +02:00
lowdefyDefault.cjs fix(servers): Use a empty app config instead of starter config for lowdefy default. 2021-06-08 15:30:57 +02:00
package.json chore: Update docker server project config. 2021-08-11 13:15:32 +02:00
README.md fix: Fix Docker server docs 2021-08-11 13:15:08 +02:00

@lowdefy/server-docker

The official Lowdefy Docker images can be found on Docker Hub.

Examples of Docker configuration can be found in the example repository.

The Lowdefy Docker images contain a Lowdefy server. The configuration of the Lowdefy app can either be built into a new image based on the Lowdefy image, or the configuration read from the file system, usually provided as a volume.

The Lowdefy server can be configured using the following environment variables:

  • LOWDEFY_SERVER_BUILD_DIRECTORY: The directory of the built Lowdefy configuration (The output of lowdefy build, usually found at ./.lowdefy/build in your project repository). The default is ./build (or /home/node/lowdefy/build).
  • LOWDEFY_SERVER_PUBLIC_DIRECTORY: The directory of the public assets to be served. The default is ./public (or /home/node/lowdefy/public).
  • LOWDEFY_SERVER_PORT: The port (inside the container) at which to run the server. The default is 3000.

When updating your app to a new Lowdefy version, make sure to update the Lowdefy version in the Dockerfile

Building a Lowdefy app image

To build the configuration into an image, the following Dockerfile can be used:

FROM node:14-buster AS build

# Set working directory and node user
WORKDIR /home/node/lowdefy

RUN chown node:node /home/node/lowdefy

USER node

# Copy app config and change ownership of files to "node" user
COPY  --chown=node:node  . .

# Build the Lowdefy config using the Lowdefy CLI
RUN npx lowdefy@latest build

# Use the correct Lowdefy base image
FROM lowdefy/lowdefy:3.19.0

# Copy build output from build stage
COPY --from=build --chown=node:node /home/node/lowdefy/.lowdefy/build ./build

# Copy contents of public directory into image
COPY --chown=node:node ./public ./public

# Run the server on start
CMD ["node", "./dist/server.js"]

with a .dockerignore file:

.lowdefy/**
.env

An image can be built by running:

docker build -t <tag> .

The container can be run by:

docker run -p 3000:3000 <tag>

Docker compose can also be used. Use a docker-compose.yaml file:

version: "3.8"
services:
  lowdefy:
    build: .
    ports:
      - "3000:3000"

To build the image, run:

docker compose build

To run the app, run:

docker compose up

More Lowdefy resources

Licence

Apache-2.0