As I was trying to follow this tutorial https://github.com/digitalocean/sample-dockerfile, I kept failing on the deploy which took around ~ 8 minutes. Here is my Dockerfile:
FROM golang:latest
WORKDIR /opt/app
COPY . .
# Install npm
WORKDIR /opt/app/client
COPY ./client/package.json ./
COPY ./client/package-lock.json ./
ENV NODE_VERSION=19.4.0
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN npm install
RUN npm run build
WORKDIR /opt/app
EXPOSE 10000
# Production:
RUN go build -o /docker-go-server
ENTRYPOINT [ "/docker-go-server" ]
In the tutorial however, the last command is CMD and not entrypoint, but I assume this doesn’t matter since there is an option in the app platform settings for an overriding run command.
I cannot check the logs either since they are empty for deploy, the build output is fine as it ends with:
[2023-01-30 10:00:05] │ INFO[0148] Taking snapshot of files...
[2023-01-30 10:00:08] │ INFO[0150] Pushing layer <registry-uri-23> to cache now
[2023-01-30 10:00:08] │ INFO[0150] Pushing image to <registry-uri-24>
[2023-01-30 10:00:08] │ INFO[0150] ENTRYPOINT [ "/docker-go-server" ]
[2023-01-30 10:00:08] │ INFO[0150] No files changed in this command, skipping snapshotting.
[2023-01-30 10:00:13] │ INFO[0156] Pushed <registry-uri-25>
[2023-01-30 10:00:13] │ INFO[0156] Pushing image to <image-26>
[2023-01-30 10:00:22] │ INFO[0164] Pushed <registry-uri-27>
[2023-01-30 10:00:22] │
[2023-01-30 10:00:22] │ ✔ built and uploaded app container image to DOCR
[2023-01-30 10:00:22] ╰──────────────────────────────────────────╼
[2023-01-30 10:00:22]
[2023-01-30 10:00:22] ✔ build complete
[2023-01-30 10:00:22]
[]
Thanks! :)
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!
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.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Hi there,
It looks like the build is successful but it sounds like your health checks are failing.
What I’ve noticed in your Dockerfile is that you are exposing port 10000, did you also change the health check port to match the custom port that you are exposing?
Best,
Bobby