mirror of
https://github.com/pawelmalak/snippet-box.git
synced 2025-12-21 13:23:05 +01:00
Created one Dockerfile for all platforms. Updated README file
This commit is contained in:
20
Dockerfile
20
Dockerfile
@@ -1,11 +1,12 @@
|
||||
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 . .
|
||||
|
||||
# Install client dependencies
|
||||
@@ -14,13 +15,22 @@ RUN mkdir -p ./public ./data \
|
||||
&& npm install \
|
||||
&& npm rebuild node-sass
|
||||
|
||||
# Build
|
||||
# Build
|
||||
RUN npm run build \
|
||||
&& mv ./client/build/* ./public
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
89
README.md
89
README.md
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user