Add dockerfile + compose, update readme

This commit is contained in:
Matthew Barnes 2023-06-24 14:14:10 +01:00
parent f409da325a
commit ab360946a3
Signed by: mb2g17
GPG Key ID: 2D2CFBEE0B64E30B
3 changed files with 34 additions and 1 deletions

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM node:18
WORKDIR /src
# Copy source
COPY . /src
# Install npm packages
RUN /bin/bash -c "npm i"
# Build project
RUN /bin/bash -c "npm run build"
# Serve project
CMD node build

View File

@ -4,7 +4,7 @@
A portfolio made with SvelteKit, TailwindCSS, and DaisyUI.
## Building
## Building manually
```bash
# install dependencies
@ -18,6 +18,17 @@ $ npm run build
$ node build
```
## Building with docker (compose)
```bash
# Build + run the dockerfile while publishing port 3000
$ docker build -t portfolio2023 .
$ docker run -p 3000:3000 portfolio2023
# Or, just use the docker-compose file
$ docker-compose up -d
```
## Adding a project
Create a new `[slug].md` file in `src/routes/projects`, following the template:

8
docker-compose.yml Normal file
View File

@ -0,0 +1,8 @@
version: "3.7"
services:
portfolio2023:
build: .
ports:
- "3000:3000"
restart: always