Question

Mount volume to a Docker app

Hello! I have a Docker application with Node.JS inside which is launched as an App. I’d like to mount a Volume to the App, how can I do this? I have Dockerfile and app.yaml:

app.yaml:

name: media-server
services:
  - dockerfile_path: Dockerfile
    github:
      branch: master
      deploy_on_push: true
      repo: name/media-server
    name: node
    http_port: 3010

Dockerfile:

FROM node:16-alpine as builder
RUN apk add --update --no-cache file imagemagick
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app
COPY package.json yarn.lock ./
USER node
RUN yarn install
COPY --chown=node:node . .
RUN yarn build
CMD ["yarn", "start"]
EXPOSE 3010

Thank you in advance!


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

With the App platform, you currently can not use Block storage volumes. Block storage volumes are detachable network volumes that are mounted directly in the filesystem and extend the storage available to an instance. Because App Platform instances can be scaled and are ephemeral, more work needs to be done to ensure these mounts remain persistent and the data view that each instance sees is consistent.

What you could do is use an S3 storage like the Spaces instead:

https://docs.digitalocean.com/products/app-platform/how-to/store-data/

Best,

Bobby