Add dockerfile and action
This commit is contained in:
1 parent
66870f4c1f
commit
fee258a8f2
2 files changed
+76
No files matched your search
@@ -0,0 +1,46 @@
|
|||||||
|
name: Staging deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["develop"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker-build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build Client Docker image
|
||||||
|
run: |
|
||||||
|
docker build \
|
||||||
|
-t ghcr.io/bluewave-labs/checkmate-frontend:staging \
|
||||||
|
-f ./docker/staging/server.Dockerfile \
|
||||||
|
--label org.opencontainers.image.source=https://github.com/bluewave-labs/checkmate \
|
||||||
|
.
|
||||||
|
|
||||||
|
- name: Push Client Docker image
|
||||||
|
run: docker push ghcr.io/bluewave-labs/checkmate-frontend:staging
|
||||||
|
|
||||||
|
deploy-to-staging:
|
||||||
|
needs: docker-build-and-push
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: SSH into server and restart container using Docker Compose
|
||||||
|
uses: appleboy/ssh-action@v1.0.0
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.STAGING_SERVER_HOST }}
|
||||||
|
username: ${{ secrets.STAGING_SERVER_USER }}
|
||||||
|
key: ${{ secrets.STAGING_SERVER_SSH_KEY }}
|
||||||
|
script: |
|
||||||
|
cd checkmate/server/docker/staging
|
||||||
|
docker compose down
|
||||||
|
docker compose pull
|
||||||
|
docker compose up -d
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
FROM node:20-alpine AS build
|
||||||
|
|
||||||
|
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
python3 \
|
||||||
|
make g++ \
|
||||||
|
gcc \
|
||||||
|
libc-dev \
|
||||||
|
linux-headers \
|
||||||
|
libusb-dev \
|
||||||
|
eudev-dev
|
||||||
|
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
COPY . ./
|
||||||
|
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM nginx:1.27.1-alpine
|
||||||
|
|
||||||
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
COPY --from=build /app/env.sh /docker-entrypoint.d/env.sh
|
||||||
|
RUN chmod +x /docker-entrypoint.d/env.sh
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
Reference in new issue
Block a user