mirror of
https://github.com/pawelmalak/snippet-box.git
synced 2025-12-21 13:23:05 +01:00
Added docker support for ARM platform
This commit is contained in:
34
Dockerfile.arm
Normal file
34
Dockerfile.arm
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
FROM node:14-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
RUN apk --no-cache --virtual build-dependencies add python make g++ \
|
||||||
|
&& npm install
|
||||||
|
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN mkdir -p ./public ./data
|
||||||
|
|
||||||
|
# Build server code
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Build client code
|
||||||
|
RUN cd ./client \
|
||||||
|
&& npm install --production \
|
||||||
|
&& npm run build \
|
||||||
|
&& cd .. \
|
||||||
|
&& mv ./client/build/* ./public
|
||||||
|
|
||||||
|
# Clean up src files
|
||||||
|
RUN rm -rf src/ ./client \
|
||||||
|
&& npm prune --production \
|
||||||
|
&& apk del build-dependencies
|
||||||
|
|
||||||
|
EXPOSE 5000
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
CMD ["node", "build/server.js"]
|
||||||
@@ -40,13 +40,21 @@ npm run dev
|
|||||||
#### Building image
|
#### Building image
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
# Building image for Linux
|
||||||
docker build -t snippet-box .
|
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
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Deployment
|
#### Deployment
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# run container
|
# run container
|
||||||
|
# for ARM use snippet-box:arm tag
|
||||||
docker run -p 5000:5000 -v /path/to/data:/app/data snippet-box
|
docker run -p 5000:5000 -v /path/to/data:/app/data snippet-box
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user