1
0
portfolio/Dockerfile
Kevin Matsubara 266653b48b Do not expose port 443 in internal dockerfile.
It is no longer needed, since all HTTPS traffic will be handled by the Nginx service on the server hosting the docker containers.
2024-12-31 10:32:09 +01:00

30 lines
914 B
Docker

# stage 1 - build react and elm apps first
FROM node:20.5.1-alpine AS build
RUN apk update &&\
apk --no-cache add curl &&\
curl -sL https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz -o /tmp/elm.gz &&\
gunzip /tmp/elm.gz &&\
mv /tmp/elm /usr/local/bin/elm &&\
chmod +x /usr/local/bin/elm &&\
apk del curl
WORKDIR /app
ENV PATH=/app/node_modules/.bin:$PATH
COPY ./package.json /app/
RUN npm install
COPY . /app
RUN npm run build
WORKDIR /app/src/michelaben
RUN elm make src/Main.elm --output=index.js
# stage 2 - build the final image and copy the react build files
FROM nginx:1.25.1-alpine
COPY --from=build /app/build /usr/share/nginx/html
COPY --from=build /app/src/michelaben /usr/share/nginx/html/michelaben
RUN rm /etc/nginx/conf.d/default.conf
COPY config/nginx/nginx.conf /etc/nginx/conf.d
EXPOSE 80
#EXPOSE 443
CMD ["nginx", "-g", "daemon off;"]