Browse Source

first docker example

master
goldengel 1 year ago
parent
commit
0f974257b4
  1. 19
      Dockerfile
  2. 14
      README.md

19
Dockerfile

@ -1,14 +1,13 @@ @@ -1,14 +1,13 @@
FROM node:18.7.0
FROM node:22.13.1-alpine AS build
WORKDIR /app
COPY package.json package.json
COPY yarn.lock yarn.lock
COPY package.json ./
COPY package-lock.json ./
RUN npm install
COPY . ./
RUN npm run build
RUN yarn
COPY . .
RUN yarn build
CMD [ "yarn", "preview", "--host" ]
EXPOSE 80
FROM nginx:1.19-alpine
COPY --from=build /app/build /usr/share/nginx/html

14
README.md

@ -54,3 +54,17 @@ npm run build @@ -54,3 +54,17 @@ npm run build
You can preview the production build with `npm run preview`.
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
## Docker
To run docker type:
```bash
docker build . -t gc-alexandria
docker run --rm --name=gc-alexandria -p 4174:80 gc-alexandria
```
Notes:
Dockerized Alexandria starts at port 4174 instead of 4173 in the example. Change the port if you like it.
<br>Internet page used as guide: https://www.sveltesociety.dev/recipes/publishing-and-deploying/dockerize-a-svelte-app

Loading…
Cancel
Save