Skip to content

Commit 2f1b27d

Browse files
committed
Update containerization and documentation
1 parent 5027279 commit 2f1b27d

File tree

5 files changed

+130
-44
lines changed

5 files changed

+130
-44
lines changed

Dockerfile

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
1-
FROM node:14
1+
FROM node:lts-alpine AS build
2+
WORKDIR /app
23
COPY package.json .
34
COPY package-lock.json .
45
RUN npm ci
56
COPY . .
67
RUN npm run build
78

8-
FROM nginx:1.19-alpine
9-
COPY --from=0 ./build /usr/share/nginx/html
9+
FROM nginx:1.27.2-alpine AS prod
10+
COPY --from=build /app/dist /usr/share/nginx/html
11+
12+
FROM node:lts AS dev
13+
ARG ls_improvement=false
14+
ARG rm_cp_mv_interactive=false
15+
ARG warp=false
16+
WORKDIR /app
17+
EXPOSE 5173
18+
RUN if [ "$ls_improvement" = "true" ]; then \
19+
sed -i '/^# export LS_OPTIONS=\|^# alias ls=\|^# alias ll=\|^# alias l=/s/^# //g' ~/.bashrc; \
20+
fi
21+
RUN if [ "$rm_cp_mv_interactive" = "true" ]; then \
22+
sed -i '/^# alias rm=\|^#alias cp=\|^# alias mv=/s/^# //g' ~/.bashrc; \
23+
fi
24+
RUN if [ "$warp" = "true" ]; then \
25+
echo "printf '\eP\$f{\"hook\": \"SourcedRcFileForWarp\", \"value\": { \"shell\": \"bash\" }}\x9c'" >> ~/.bashrc; \
26+
fi

README.md

Lines changed: 82 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,112 @@
1-
# <WebdevHome />
1+
# WebdevHome
22

3-
![Build and deploy website](https://github.com/webdevhome/webdevhome.github.io/workflows/Build%20and%20deploy%20website/badge.svg)
3+
This is a collection of links I, as a web developer, use very frequently. Maybe you will find them useful, too.
44

5-
[webdevhome.github.io](https://webdevhome.github.io)
5+
[Open WebdevHome](https://webdevhome.github.io)
66

7-
This is a collection of links I, as a web developer, use very frequently. Maybe you will find them useful, too.
7+
## How to use
88

9-
## Credits
9+
### Search links
1010

11-
[TypeScript](https://github.com/microsoft/TypeScript)
12-
[React](https://github.com/facebook/react)
13-
[farzher/fuzzysort](https://github.com/farzher/fuzzysort)
14-
[TailwindCSS](https://tailwindcss.com/)
15-
[Simple Icons](https://github.com/simple-icons/simple-icons)
16-
[Material Design Icons](https://github.com/Templarian/MaterialDesign)
11+
By just typing in the name of a website the links get filtered automatically.
1712

18-
## Development
13+
E.g. typing `gh` » `Return` opens GitHub.
1914

20-
To start WebdevHome locally run:
15+
### Search on other websites
2116

22-
```shell
23-
npm ci
24-
```
17+
By clicking the magnifier icon next to a link, or by pressing `Tab` while on the search page you can enter a search term
18+
that gets sent to that website.
19+
20+
E.g. typing `npm` » `Tab` » `react` » `Return` starts a search for "react" on npm.com.
21+
22+
### Link info
23+
24+
Hover over a link and a tooltip will appear with more details about the linked website.
25+
26+
### Customize links
27+
28+
By clicking on "Options" and then "Customize links" you can hide some links that you don't want to see or use less
29+
frequently.
30+
31+
You can still access them by clicking "Show x hidden links" or by using the search. Hidden links will be sorted to the
32+
bottom while using the search.
33+
34+
**Caveat:** If you hide all links inside a group the group is hidden entirely. So, there's no "Show x hidden links"
35+
button. You can still find them in the search though.
36+
37+
### Theme
38+
39+
You can choose between "Light", "Dark", and "System". The "System" theme will apply the light or dark theme depending on
40+
your operating system or browser settings.
2541

26-
and then:
42+
## Run development
43+
44+
### Using Node.js
2745

2846
```shell
47+
# Install dependencies
48+
npm ci
49+
50+
# Start dev server
2951
npm run dev
3052
```
3153

32-
This starts a watcher that builds the project every time you make some changes. Also, the local version of your app (running on localhost:3000) gets opened in your default browser automatically.
54+
The app is now running on http://localhost:5173.
55+
56+
End the dev server by pressing `[Ctrl]` + `[C]` in your terminal.
57+
58+
### Using Docker
3359

34-
End the watcher script by pressing `[Ctrl]` + `[C]` in your terminal.
60+
```shell
61+
# Build image
62+
docker build . --target dev --tag webdevhome-dev --build-arg warp=true --build-arg ls_improvement=true --build-arg rm_cp_mv_interactive=true
3563

36-
## Run in a Docker environment
64+
# Create and run container
65+
docker run --name webdevhome-dev --publish 5173:5173 --detach --tty webdevhome-dev
66+
```
3767

38-
If you want to run this app in your own Docker environment run the following commands from inside the project root directory:
68+
### Using Docker compose
3969

4070
```shell
41-
docker-compose build
71+
docker compose up --build --detach --remove-orphans dev
4272
```
4373

44-
and then:
74+
### Build args
75+
76+
| Arg | Values | Default | Description |
77+
|:---------------------|:----------------|:--------|:--------------------------------------------------------------------------------|
78+
| ls_improvement | `true`, `false` | `false` | Enable colors for `ls` command and enable aliases `ls`, `ll`, and `l`. |
79+
| rm_cp_mv_interactive | `true`, `false` | `false` | Enable aliases for `rm`, `cp`, and `mv` to automatically include the `-i` flag. |
80+
| warp | `true`, `false` | `false` | Enable Warp support for console. |
81+
82+
## Run production
83+
84+
### Using Docker
4585

4686
```shell
47-
docker-compose up
87+
# Build image
88+
docker build . --target prod --tag webdevhome
89+
90+
# Create and run container
91+
docker run --name webdevhome --publish 80:80 --detach webdevhome-prod
4892
```
4993

50-
_Or `docker-compose up -d` to run in detached mode._
94+
Change the ports accordingly.
5195

52-
_Halt the app in detached mode by running `docker-compose down`._
96+
### Using Docker compose
5397

54-
If you make any changes, start again at `docker-compose build`.
98+
If you want to run this app in your own Docker environment run the following commands from inside the project root
99+
directory:
55100

56-
**Important:** If you change the `dependencies` in `package.json` directly you have to run `npm install` locally before running `docker-compose build`! Better use `npm i <package-name>` to add dependencies or `npm un <package-name>` to remove packages instead.
101+
```shell
102+
docker compose up --build --detach --remove-orphans webdevhome
103+
```
57104

58-
---
105+
## Credits
59106

60-
Developed and maintained by: Andreas Linnert ([alinnert](https://github.com/alinnert))
107+
[TypeScript](https://github.com/microsoft/TypeScript)
108+
[React](https://github.com/facebook/react)
109+
[farzher/fuzzysort](https://github.com/farzher/fuzzysort)
110+
[TailwindCSS](https://tailwindcss.com/)
111+
[Simple Icons](https://github.com/simple-icons/simple-icons)
112+
[Material Design Icons](https://github.com/Templarian/MaterialDesign)

compose.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: webdevhome
2+
3+
services:
4+
frontend:
5+
container_name: webdevhome
6+
build:
7+
context: .
8+
target: prod
9+
ports:
10+
- "80:80"
11+
12+
dev:
13+
container_name: webdevhome-dev
14+
build:
15+
context: .
16+
target: dev
17+
args:
18+
ls_improvement: true
19+
rm_cp_mv_interactive: true
20+
warp: true
21+
ports:
22+
- "5173:5173"
23+
volumes:
24+
- type: bind
25+
source: .
26+
target: /app
27+
tty: true

docker-compose.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "2.4.3",
44
"type": "module",
55
"scripts": {
6-
"dev": "vite",
6+
"dev": "vite --host 0.0.0.0",
77
"build": "npm test && vite build",
88
"preview": "vite preview",
99
"test": "tsc && eslint src",

0 commit comments

Comments
 (0)