Created one Dockerfile for all platforms. Updated README file

This commit is contained in:
Paweł Malak
2021-11-18 16:30:04 +01:00
parent f501941a22
commit 0665e1274d
3 changed files with 72 additions and 53 deletions

View File

@@ -1,10 +1,11 @@
FROM node:14-alpine
FROM node:14-alpine3.11 AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
RUN apk --no-cache --virtual build-dependencies add python make g++ \
&& npm install
COPY . .
@@ -20,7 +21,16 @@ RUN npm run build \
# Clean up src files
RUN rm -rf src/ ./client \
&& npm prune --production
&& npm prune --production \
&& apk del build-dependencies
FROM node:14-alpine
USER node
WORKDIR /app
COPY --from=builder /app /app
EXPOSE 5000

View File

@@ -1,11 +1,10 @@
FROM node:14-alpine
FROM node:14-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN apk --no-cache --virtual build-dependencies add python make g++ \
&& npm install
RUN npm install
COPY . .
@@ -21,8 +20,15 @@ RUN npm run build \
# Clean up src files
RUN rm -rf src/ ./client \
&& npm prune --production \
&& apk del build-dependencies
&& npm prune --production
FROM node:14-alpine
USER node
WORKDIR /app
COPY --from=builder /app /app
EXPOSE 5000

View File

@@ -6,62 +6,35 @@
Snippet Box is a simple self-hosted app for organizing your code snippets. It allows you to easily create, edit, browse and manage your snippets in various languages. With built-in Markdown support, Snippet Box makes it very easy to add notes or simple documentation to your code.
## Technology
- Backend
- Node.js
- Typescript
- Express.js
- Sequelize ORM + SQLite
- Frontend
- React
- TypeScript
- Bootstrap
- Deployment
- Docker
## Development
```sh
# clone repository
git clone https://github.com/pawelmalak/snippet-box
cd snippet-box
# install dependencies (run only once)
npm run init
# start backend and frontend development servers
npm run dev
```
## Installation
### With Docker
#### Docker Hub
[Docker Hub image link](https://hub.docker.com/r/pawelmalak/snippet-box).
For arm platforms use `:arm` tag.
#### Building image
[Docker Hub link](https://hub.docker.com/r/pawelmalak/snippet-box)
```sh
# Building image for Linux
docker build -t snippet-box .
# Build image for ARM
docker buildx build \
--platform linux/arm/v7,linux/arm64 \
-f Dockerfile.arm \
-t snippet-box:arm .
docker pull pawelmalak/snippet-box
```
#### Deployment
```sh
# run container
# for ARM use snippet-box:arm tag
docker run -p 5000:5000 -v /path/to/data:/app/data snippet-box
# Create container
docker run -p 5000:5000 -v /path/to/host/data:/app/data pawelmalak/snippet-box
```
#### Building image
```sh
# Building single image
docker build -t snippet-box .
# Building multiarch image
docker buildx build \
--platform linux/arm/v7,linux/arm64,linux/amd64 \
-t snippet-box .
```
#### Docker Compose
@@ -83,6 +56,36 @@ services:
Follow instructions from wiki - [Installation without Docker](https://github.com/pawelmalak/snippet-box/wiki/Installation-without-Docker)
## Development
### Technology
- Backend
- Node.js
- Typescript
- Express.js
- Sequelize ORM + SQLite
- Frontend
- React
- TypeScript
- Bootstrap
- Deployment
- Docker
### Creating dev environment
```sh
# clone repository
git clone https://github.com/pawelmalak/snippet-box
cd snippet-box
# install dependencies (run only once)
npm run init
# start backend and frontend development servers
npm run dev
```
## Functionality
- Search