Skip to content

Commit 81a0919

Browse files
authored
feat: docker (#24)
1 parent 17e3d9b commit 81a0919

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!src
3+
!package.json
4+
!package-lock.json
5+
!tsconfig.json

.github/workflows/release.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Ensure lowercase repository name
13+
run: echo "REPO_LC=${REPO,,}" >> ${GITHUB_ENV}
14+
env:
15+
REPO: ${{ github.repository }}
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
- name: Set up QEMU
19+
uses: docker/setup-qemu-action@v2
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v2
22+
- name: Login to GitHub Container Registry
23+
uses: docker/login-action@v2
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.repository_owner }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
- name: Build and push
29+
uses: docker/build-push-action@v3
30+
with:
31+
context: .
32+
platforms: linux/amd64,linux/arm64
33+
push: true
34+
tags: ghcr.io/${{ env.REPO_LC }}:latest
35+
cache-from: type=gha
36+
cache-to: type=gha,mode=max

Dockerfile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM node:16-bullseye-slim
2+
3+
WORKDIR /app
4+
5+
RUN mkdir /app/data && \
6+
chown -R node:node /app
7+
8+
RUN apt update && \
9+
apt upgrade -y && \
10+
apt install -y \
11+
build-essential \
12+
python3 \
13+
dumb-init
14+
15+
USER node:node
16+
17+
COPY --chown=node:node package-lock.json package.json tsconfig.json ./
18+
19+
RUN sed -i 's/"prepare": "husky install"/"prepare": ""/' ./package.json
20+
21+
RUN npm install
22+
23+
COPY --chown=node:node src/ src/
24+
25+
RUN npm run build
26+
27+
ENTRYPOINT [ "/usr/bin/dumb-init", "--" ]
28+
CMD [ "npm", "run", "run" ]

0 commit comments

Comments
 (0)