Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Why is my svelte app runs on localhost but NOT on AWS Lightsail?

$
0
0

I have a Dockerized Svelte application that runs perfectly on my local machine, but I’m having trouble deploying it on AWS Lightsail. Here’s what I’ve done so far:

Error

Lightsail Error Message

Log

[3/Jul/2024:08:42:00] [deployment:1] Creating your deployment[3/Jul/2024:08:42:13] exec /usr/local/bin/docker-entrypoint.sh: exec format error[3/Jul/2024:08:43:02] [deployment:1] Started 1 new node[3/Jul/2024:08:43:18] exec /usr/local/bin/docker-entrypoint.sh: exec format error[3/Jul/2024:08:44:13] [deployment:1] Started 1 new node[3/Jul/2024:08:44:22] exec /usr/local/bin/docker-entrypoint.sh: exec format error[3/Jul/2024:08:45:27] [deployment:1] Started 1 new node[3/Jul/2024:08:45:44] exec /usr/local/bin/docker-entrypoint.sh: exec format error[3/Jul/2024:08:46:02] [deployment:1] Canceled

Lightsail Container settings

  • Created a container service on Lightsail.
  • Added a container with the following details:
    • Container name: frontend
    • feed Image from ECR
  • Set the PUBLIC ENDPOINT to use port :3000.

Lightsail container settings

Dockerfile

FROM node:18-alpine AS builderWORKDIR /appCOPY package*.json .RUN npm ciCOPY . .RUN npm run buildRUN npm prune --productionFROM node:18-alpineWORKDIR /appCOPY --from=builder /app/build build/COPY --from=builder /app/node_modules node_modules/COPY package.json .EXPOSE 3000 # <--- I thought this would workENV NODE_ENV=productionCMD [ "node", "build" ]

Docker Desktop setup

When I run docker image on local machine, it will work without any issue.

I can access it from localhost:3000 or localhost if i change port to :80

Docker desktop settings


Docker Desktop uses tcp, so i thought that was a reason why i had this issue, but I am not able to add :3000 tcp as Public Endpoint.

Update

I tested out with sveltekit app without any code modification (Skelton project). With Sveltkit dockerfile setup reference. So, i didn't have any env variable set on Lightsail.


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>