mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
Add build stage and remove linux/arm/v7
This commit is contained in:
parent
17ae6668b4
commit
a0f46c326a
2
.github/workflows/docker-image.yaml
vendored
2
.github/workflows/docker-image.yaml
vendored
@ -79,7 +79,7 @@ jobs:
|
|||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
platforms: linux/amd64,linux/arm64, linux/arm/v7
|
platforms: linux/amd64,linux/arm64
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
44
Dockerfile
44
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
|
FROM node:21-alpine
|
||||||
|
|
||||||
# Set labels
|
# Set labels
|
||||||
@ -6,30 +30,24 @@ LABEL license="AGPL-3.0,https://github.com/HeyPuter/puter/blob/master/LICENSE.tx
|
|||||||
LABEL version="1.2.46-beta-1"
|
LABEL version="1.2.46-beta-1"
|
||||||
|
|
||||||
# Install git (required by Puter to check version)
|
# Install git (required by Puter to check version)
|
||||||
# python3 would be required by node-gyp to natively build node addon
|
RUN apk add --no-cache git
|
||||||
# This is required if we build for multi-platform
|
|
||||||
RUN apk add --no-cache git python3 make g++ \
|
|
||||||
&& ln -sf /usr/bin/python3 /usr/bin/python
|
|
||||||
|
|
||||||
# Setup working directory
|
# Set up working directory
|
||||||
RUN mkdir -p /opt/puter/app
|
RUN mkdir -p /opt/puter/app
|
||||||
WORKDIR /opt/puter/app
|
WORKDIR /opt/puter/app
|
||||||
|
|
||||||
# Add source files
|
# Copy built artifacts and necessary files from the build stage
|
||||||
# NOTE: This might change (https://github.com/HeyPuter/puter/discussions/32)
|
COPY --from=build /app/dist ./dist
|
||||||
COPY . .
|
COPY --from=build /app/node_modules ./node_modules
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
RUN chown -R node:node /opt/puter/app
|
RUN chown -R node:node /opt/puter/app
|
||||||
USER node
|
USER node
|
||||||
|
|
||||||
# Install node modules
|
|
||||||
RUN npm cache clean --force \
|
|
||||||
&& npm install
|
|
||||||
|
|
||||||
EXPOSE 4100
|
EXPOSE 4100
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=3s \
|
HEALTHCHECK --interval=30s --timeout=3s \
|
||||||
CMD wget --no-verbose --tries=1 --spider http://puter.localhost:4100/test || exit 1
|
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