2021-05-02 15:53:01 +02:00
|
|
|
## Build UI
|
2023-12-11 15:53:20 +01:00
|
|
|
FROM node:20-alpine as ui
|
2019-07-15 16:30:35 +02:00
|
|
|
|
2021-05-02 15:53:01 +02:00
|
|
|
WORKDIR /usr/src/ui
|
|
|
|
|
2022-02-28 09:08:10 +01:00
|
|
|
RUN apk --update --no-cache add curl bash g++ make libpng-dev
|
2021-05-02 15:53:01 +02:00
|
|
|
|
|
|
|
# install node-prune (https://github.com/tj/node-prune)
|
2022-07-28 08:02:14 +02:00
|
|
|
RUN curl -sf https://gobinaries.com/tj/node-prune | sh
|
2020-06-03 11:21:52 +02:00
|
|
|
|
|
|
|
COPY ui/ .
|
2016-08-17 12:04:42 -07:00
|
|
|
|
2020-06-03 11:21:52 +02:00
|
|
|
RUN yarn install --frozen-lockfile
|
2021-05-02 15:53:01 +02:00
|
|
|
RUN yarn build
|
|
|
|
|
|
|
|
# remove development dependencies
|
|
|
|
RUN npm prune --production
|
2019-07-15 15:02:21 +02:00
|
|
|
|
2021-05-02 15:53:01 +02:00
|
|
|
# run node prune
|
2021-05-06 20:12:03 +02:00
|
|
|
# there is some problem running node prune that then prevents the frontend to load (just start with /form/1 and it will crash)
|
|
|
|
#RUN /usr/local/bin/node-prune
|
2021-05-02 15:53:01 +02:00
|
|
|
|
|
|
|
## Build API
|
2023-12-11 15:53:20 +01:00
|
|
|
FROM node:20-alpine as api
|
2020-06-01 22:11:00 +02:00
|
|
|
LABEL maintainer="OhMyForm <admin@ohmyform.com>"
|
2019-10-09 05:10:25 +02:00
|
|
|
|
2021-05-02 15:53:01 +02:00
|
|
|
WORKDIR /usr/src/api
|
2020-06-03 11:21:52 +02:00
|
|
|
|
2023-12-11 15:53:32 +01:00
|
|
|
RUN apk --update --no-cache add curl bash g++ make libpng-dev python3
|
2020-06-16 10:45:52 +02:00
|
|
|
|
|
|
|
# install node-prune (https://github.com/tj/node-prune)
|
2022-07-28 08:02:14 +02:00
|
|
|
RUN curl -sf https://gobinaries.com/tj/node-prune | sh
|
2020-06-16 10:45:52 +02:00
|
|
|
|
2020-06-03 11:21:52 +02:00
|
|
|
COPY api/ .
|
2021-05-02 15:53:01 +02:00
|
|
|
|
|
|
|
RUN touch /usr/src/api/src/schema.gql && chown 9999:9999 /usr/src/api/src/schema.gql
|
2020-06-03 11:21:52 +02:00
|
|
|
|
|
|
|
RUN yarn install --frozen-lockfile
|
|
|
|
RUN yarn build
|
2020-06-16 10:45:52 +02:00
|
|
|
|
|
|
|
# remove development dependencies
|
|
|
|
RUN npm prune --production
|
|
|
|
|
|
|
|
# run node prune
|
|
|
|
RUN /usr/local/bin/node-prune
|
|
|
|
|
2020-06-16 18:52:24 +12:00
|
|
|
## Production Image.
|
2023-12-11 15:53:20 +01:00
|
|
|
FROM node:20-alpine
|
2020-06-16 18:52:24 +12:00
|
|
|
|
2021-05-02 15:53:01 +02:00
|
|
|
RUN apk --update add supervisor nginx && rm -rf /var/cache/apk/*
|
|
|
|
|
|
|
|
WORKDIR /usr/src
|
|
|
|
|
|
|
|
COPY --from=api /usr/src/api /usr/src/api
|
|
|
|
COPY --from=ui /usr/src/ui /usr/src/ui
|
|
|
|
|
2020-06-16 10:45:52 +02:00
|
|
|
RUN addgroup --gid 9999 ohmyform && adduser -D --uid 9999 -G ohmyform ohmyform
|
2021-05-02 15:53:01 +02:00
|
|
|
ENV SECRET_KEY=ChangeMe \
|
2020-06-03 11:21:52 +02:00
|
|
|
CREATE_ADMIN=FALSE \
|
|
|
|
ADMIN_EMAIL=admin@ohmyform.com \
|
|
|
|
ADMIN_USERNAME=root \
|
2022-01-03 00:58:36 +01:00
|
|
|
ADMIN_PASSWORD=root \
|
|
|
|
NODE_ENV=production
|
2020-06-03 11:21:52 +02:00
|
|
|
|
|
|
|
EXPOSE 3000
|
2021-05-02 15:53:01 +02:00
|
|
|
|
2021-12-07 23:40:15 +01:00
|
|
|
RUN mkdir -p /run/nginx/
|
2021-05-02 15:53:01 +02:00
|
|
|
RUN touch /usr/src/supervisord.log && chmod 777 /usr/src/supervisord.log
|
|
|
|
COPY supervisord.conf /etc/supervisord.conf
|
2022-01-13 16:47:35 +01:00
|
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
2021-05-02 15:53:01 +02:00
|
|
|
|
|
|
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
|
|
|
# CMD [ "yarn", "start:prod" ]
|