geckosio / docker-example

🐋 Docker Example
https://hub.docker.com/r/yandeu/geckos.io-example
2 stars 0 forks source link

Add example to deploy to fly.io #1

Open oskarrough opened 2 years ago

oskarrough commented 2 years ago

Hi and thank you for the example. Howeve,r I couldn't figure out how to configure the ports correctly with when deploying to fly.io. Should you find some time to look I think it'd be a nice way to deploy geckos.io.

ktitaro commented 1 month ago

The main challenge with deploying on fly.io appears to be related to the Dockerfile setup. I tried using the example Dockerfile from this repository, but it didn't work for me. After making a few adjustments, I managed to get it working. Apart from the Dockerfile, the deployment process is similar to any other Node.js app. Here is the Dockerfile I used:

FROM ubuntu:22.04
RUN apt-get update && apt-get -y install sudo
RUN useradd -m ubuntu && echo "ubuntu:ubuntu" | chpasswd && adduser ubuntu sudo
RUN sudo apt install curl -yq && sudo apt install cmake -yq

RUN curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - && \
  sudo apt-get install -y nodejs && \
  sudo npm install -g npm@latest && \
  sudo npm install -g gitget@latest

WORKDIR /home/ubuntu/app
COPY . .
RUN sudo chown -R ubuntu:ubuntu /home/ubuntu/app
USER ubuntu
RUN npm install
RUN npm run build
ENV NODE_ENV=production
CMD ["npm", "run", "start"]