The title pretty much says it all. I am very new to web development.
I created a Svelte app using npx degit sveltejs/template ...
. Now I run it locally using npm run dev
or npm start
.
To my understanding, this is a Node server, but adapting their official tutorial didn't get me very far.
I found a blog post about this, but it doesn't quite explain how to dockerize an existing Svelte app, instead points to a fork of the official template.
Go to https://app.netlify.com/start and select the source of you code (gitlab, github, bitbucket) then select the repository of your dockerized Svelte application. Set the branch (to master for example), the build command to "npm run build" and the publish directory to "public" and click on "Deploy Site".
Creating the Flask app Let's proceed to create a simple Flask application that renders a message on the browser. Create a folder with the name flask_docker to contain your application. Next, cd into the flask_docker directory and run the below command to install Flask. In the code snippet above, the @app.
You can place a Dockerfile
in your app directory (where package.json
is):
FROM node:14-alpine
WORKDIR /usr/src/app
COPY rollup.config.js ./
COPY package*.json ./
RUN npm install
COPY ./src ./src
COPY ./public ./public
RUN npm run-script build
EXPOSE 5000
ENV HOST=0.0.0.0
CMD [ "npm", "start" ]
Build a local image:
$ docker build -t svelte/myapp .
And run it:
$ docker run -p 5000:5000 svelte/myapp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With