Skip to content

Commit

Permalink
build: Cross compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Dec 1, 2023
1 parent 72684d6 commit 8ac047c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
FROM node:alpine
FROM --platform=$BUILDPLATFORM node:alpine as builder

ARG VERSION_ARG="0.0"
ARG TARGETOS TARGETARCH
ENV NODE_ENV=production
WORKDIR /portainer-backup

# INSTALL ADDITIONAL IMAGE DEPENDENCIES AND COPY APPLICATION TO IMAGE
RUN apk update && apk add --no-cache tzdata
RUN mkdir -p /portainer-backup/src
COPY package.json /portainer-backup
COPY src/*.js /portainer-backup/src
RUN sed -i 's/0.0.0-development/$VERSION_ARG/' /portainer-backup/package.json
WORKDIR /portainer-backup
VOLUME "/backup"

RUN npm install --omit=dev

FROM node:alpine as runner
ENV NODE_ENV=production

RUN apk update && apk add --no-cache tzdata

VOLUME "/backup"
WORKDIR /portainer-backup

COPY --from=builder /portainer-backup /portainer-backup

# DEFAULT ENV VARIABLE VALUES
ENV TZ="America/New_York"
ENV PORTAINER_BACKUP_URL="http://portainer:9000"
Expand Down

0 comments on commit 8ac047c

Please sign in to comment.