DEV Community

Cover image for Portfolio - Deploying in App platform
Christopher Daniel
Christopher Daniel

Posted on • Updated on

Portfolio - Deploying in App platform

Deploying

Many cloud providers stick to few runtimes like node js, ruby, php, java etc, but digital ocean provides docker container along with others to deploy our sites. We can see how I deployed it using docker container for static sites.

Setup

Create a Dockerfile in your root directory. pull rust container

FROM rust:1.48-slim-buster
Enter fullscreen mode Exit fullscreen mode

Install node and yarn in docker

RUN apt-get update -y && apt-get install curl -y

RUN curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh

RUN sh nodesource_setup.sh

RUN apt install nodejs -y
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update &&  apt-get install --no-install-recommends yarn -y
Enter fullscreen mode Exit fullscreen mode

Copy source files and build your app

COPY . .
RUN yarn install && yarn build
Enter fullscreen mode Exit fullscreen mode

Test your container locally by building and running the image

docker build -t yew-portfolio .
docker run -it -p 8000 yew-portfolio
Enter fullscreen mode Exit fullscreen mode

Now test your build static files in a static file server of your choice and verify.

Now deploy it to Digital ocean using app platform.

More Info

Cover Image from Unplash

Top comments (0)