Run command and use output in dockerfile
FROM node:16 AS build
WORKDIR /app
COPY package.json ./
COPY package-lock.json ./
RUN npm install
COPY . ./
RUN npm run build
FROM nginx:1.19-alpine
COPY --from=build /app/public /usr/share/nginx/html
Dockerfile for Svelte static build behind NGINX proxy
FROM node:16 AS build
WORKDIR /app
COPY package.json ./
COPY package-lock.json ./
RUN npm install
COPY . ./
RUN npm run build
FROM nginx:1.19-alpine
COPY --from=build /app/public /usr/share/nginx/html
RUN sed -i '9 a \\ttry_files $uri $uri/ /index.html;' /etc/nginx/conf.d/default.conf
Get IP of docker container
docker inspect <container-id>
Docker compose examples
See the examples section in docker-compose-examples GitHub repo and on local machine