2023-03-23 09:50:23 +00:00
|
|
|
# Build container
|
|
|
|
ARG NODE_VERSION
|
|
|
|
FROM --platform=amd64 node:${NODE_VERSION}-alpine3.16 as build
|
|
|
|
WORKDIR /app
|
|
|
|
# Argument to allow building of different apps
|
|
|
|
ARG APP
|
2023-03-24 15:42:33 +00:00
|
|
|
RUN apk add --update --no-cache \
|
|
|
|
python3 \
|
|
|
|
make \
|
|
|
|
gcc \
|
|
|
|
g++
|
2023-03-23 09:50:23 +00:00
|
|
|
COPY . ./
|
|
|
|
RUN yarn --network-timeout 100000 --pure-lockfile
|
2023-03-24 15:42:33 +00:00
|
|
|
# work around for different build process in trading
|
|
|
|
RUN sh ./docker-build.sh
|
2023-03-23 09:50:23 +00:00
|
|
|
|
|
|
|
# Server environment
|
|
|
|
# if this fails you need to docker pull nginx:1.23-alpine and pin new SHA
|
|
|
|
# this is to ensure that we run always same version of alpine to make sure ipfs is indempotent
|
|
|
|
FROM --platform=amd64 nginx:1.23-alpine@sha256:6318314189b40e73145a48060bff4783a116c34cc7241532d0d94198fb2c9629
|
|
|
|
ARG APP
|
|
|
|
# configuration of system
|
|
|
|
RUN apk add --no-cache bash go-ipfs
|
|
|
|
EXPOSE 80
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
|
|
CMD ["/entrypoint.sh"]
|
|
|
|
|
|
|
|
# Copy dist
|
|
|
|
WORKDIR /usr/share/nginx/html
|
|
|
|
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
2023-03-24 15:42:33 +00:00
|
|
|
COPY --from=build /app/dist/apps/${APP} /usr/share/nginx/html
|
2023-03-23 09:50:23 +00:00
|
|
|
COPY ./apps/${APP}/.env .env
|
|
|
|
RUN ipfs init && echo "$(ipfs add -rQ .)" > ipfs-hash
|