mirror of
https://github.com/HeyPuter/puter.git
synced 2025-02-02 23:28:39 +08:00
Merge pull request #227 from MohamedElashri/main
Add requirements for multi-platform docker build to the CI
This commit is contained in:
commit
497c633b8a
7
.github/workflows/docker-image.yaml
vendored
7
.github/workflows/docker-image.yaml
vendored
@ -40,6 +40,12 @@ jobs:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about)
|
||||
# to extract tags and labels that will be applied to the specified image.
|
||||
@ -73,6 +79,7 @@ jobs:
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
|
43
Dockerfile
43
Dockerfile
@ -1,3 +1,27 @@
|
||||
# Build stage
|
||||
FROM node:21-alpine AS build
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache git python3 make g++ \
|
||||
&& ln -sf /usr/bin/python3 /usr/bin/python
|
||||
|
||||
# Set up working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# Install node modules
|
||||
RUN npm cache clean --force \
|
||||
&& npm ci
|
||||
|
||||
# Copy the rest of the source files
|
||||
COPY . .
|
||||
|
||||
# Run the build command if necessary
|
||||
RUN npm run build
|
||||
|
||||
# Production stage
|
||||
FROM node:21-alpine
|
||||
|
||||
# Set labels
|
||||
@ -8,25 +32,22 @@ LABEL version="1.2.46-beta-1"
|
||||
# Install git (required by Puter to check version)
|
||||
RUN apk add --no-cache git
|
||||
|
||||
# Setup working directory
|
||||
# Set up working directory
|
||||
RUN mkdir -p /opt/puter/app
|
||||
WORKDIR /opt/puter/app
|
||||
|
||||
# Add source files
|
||||
# NOTE: This might change (https://github.com/HeyPuter/puter/discussions/32)
|
||||
COPY . .
|
||||
# Copy built artifacts and necessary files from the build stage
|
||||
COPY --from=build /app/dist ./dist
|
||||
COPY --from=build /app/node_modules ./node_modules
|
||||
COPY package*.json ./
|
||||
|
||||
# Set permissions
|
||||
RUN chown -R node:node /opt/puter/app
|
||||
USER node
|
||||
|
||||
# Install node modules
|
||||
RUN npm cache clean --force \
|
||||
&& npm install
|
||||
|
||||
EXPOSE 4100
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=3s \
|
||||
CMD wget --no-verbose --tries=1 --spider http://puter.localhost:4100/test || exit 1
|
||||
HEALTHCHECK --interval=30s --timeout=3s \
|
||||
CMD wget --no-verbose --tries=1 --spider http://puter.localhost:4100/test || exit 1
|
||||
|
||||
CMD [ "npm", "start" ]
|
||||
CMD ["npm", "start"]
|
Loading…
Reference in New Issue
Block a user