refining Docker deployment process, including self-hosting

This commit is contained in:
Dave Lane 2024-08-29 12:04:45 +12:00
parent 05205b4ecb
commit d7f2ad8427
2 changed files with 20 additions and 21 deletions

View file

@ -3,40 +3,35 @@
This is an app I'm creating to visualise data I've created (in JSON form) describing my self-hosted (professional, volunteer, & personal) webservices. This is an app I'm creating to visualise data I've created (in JSON form) describing my self-hosted (professional, volunteer, & personal) webservices.
## create-svelte ## Installing the Webservices App
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte). You can clone this repository from my [Forgejo instance](https://forge.magnificent.nz) using this command (replacing the latter webservices-app with your preferred directory name!):
## Creating a project git clone https://forge.magnificent.nz/lightweight/webservices-app.git webservices-app
If you're seeing this, you've probably already done this step. Congrats! then
```bash cd webservices-app
# create a new project in the current directory npm install
npm create svelte@latest
or, if you're using pnpm, use `pnpminstall` or for yarn, `yarn`. That will install the svelte and other javascript dependencies.
# create a new project in my-app
npm create svelte@latest my-app
```
## Developing ## Developing
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: Once you've created a project and installed dependencies, start a development server:
```bash npm run dev
npm run dev
# or start the server and open the app in a new browser tab # or start the server and open the app in a new browser tab
npm run dev -- --open
``` npm run dev -- --open
## Building ## Building
To create a production version of your app: To create a production version of your app:
```bash npm run build
npm run build
```
You can preview the production build with `npm run preview`. You can preview the production build with `npm run preview`.
@ -56,6 +51,10 @@ and then run
docker-compose build docker-compose build
### You can push your new container to a docker container repository (I use my Forgejo instance!)
docker push forge.magnificent.nz/lightweight/webservices-app:latest
### To start it up (and tail the logs - CTRL-C to quit out of the logs without affecting running container) ### To start it up (and tail the logs - CTRL-C to quit out of the logs without affecting running container)
docker-compose up -d && docker-compose logs -f docker-compose up -d && docker-compose logs -f

View file

@ -1,11 +1,11 @@
# docker-compose.yml # docker-compose.yml
services: services:
external: app:
container_name: external container_name: webservices-app
# The name of the image that will be created when building this container # The name of the image that will be created when building this container
# Change this based on your app's name... # Change this based on your app's name...
image: external-website:latest image: forge.magnificent.nz/lightweight/webservices-app:latest
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile