Git Product home page Git Product logo

Comments (9)

Rich-Harris avatar Rich-Harris commented on August 19, 2024 16

When you run sapper build, Sapper creates a build directory containing your app. To run it, you need to do sapper start — this sets up all the necessary environment variables and runs build/server.js. (Note that you can also do sapper build custom-dir and sapper start custom-dir, if you want to use a destination other than build.)

Your files still exist in the assets directory. So to deploy it, you just need to put your build and assets dir on a server somewhere, npm install dependencies, and do sapper start. The exact details will differ from one platform to the next, but that's essentially how it works. You don't need do deploy the app or routes directories. Hope this helps!

from sapper-template.

tbaums avatar tbaums commented on August 19, 2024 8

Apologies for commenting on a closed issue, but given the latest updates, what files need to be included to run in Prod?

The below Dockerfile works great, but produces a heavy container (39MB). Any suggestions for how to slim this down? I've tried some of the examples on GH to use COPY --from=0 , but can't get the right mix of files to get it to deploy (K8s v1.15.X).

FROM node:12-alpine
WORKDIR /app
COPY . .
RUN npm install --save
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]

from sapper-template.

Conduitry avatar Conduitry commented on August 19, 2024 7

@rakia See https://sapper.svelte.technology/guide#exporting

from sapper-template.

Conduitry avatar Conduitry commented on August 19, 2024 4

It's now https://sapper.svelte.dev/docs#Exporting

from sapper-template.

rakia avatar rakia commented on August 19, 2024 2

Hi @Rich-Harris,
how about deploying the application in server that does not support node.js? so, I can't use npm install.
I just need a folder like /dist that I just have to copy/paste under an apache server and the app will be deployed automatically.

from sapper-template.

sgoveia avatar sgoveia commented on August 19, 2024

Brilliant! Thank you @Rich-Harris

from sapper-template.

rakia avatar rakia commented on August 19, 2024

thank you @Conduitry, you've answered my question :)

from sapper-template.

Conduitry avatar Conduitry commented on August 19, 2024

To build your app, you need the entire contents of your project as well as all of the dependencies (prod and dev).

To run your app in production, you need static, __sapper__/build, and all of your prod dependencies.

You can do this with a two-stage Dockerfile. Or you can even use a three-stage Dockerfile if you want your final image to use a base image that doesn't include any package managers.

The Svelte site has the build itself happen outside of Docker, but then uses a two-stage Docker build, the first of which is used to install npm dependencies, which are then copied into the second, which contains only Node and not npm or Yarn.

from sapper-template.

jcollum-nike avatar jcollum-nike commented on August 19, 2024

@Conduitry that link above (#exporting) is 404

from sapper-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.