Dockerfile 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # arguments
  2. ARG VERSION="master"
  3. # Branch to check out
  4. ARG CHECKOUT_BRANCH="master"
  5. FROM node:lts AS build
  6. #environment variables
  7. ENV PROJECT_NAME="headscale-ui"
  8. # URL for the github/git location
  9. ENV PROJECT_URL="https://github.com/gurucomputing/headscale-ui"
  10. # Set the staging environment
  11. WORKDIR /staging/scripts
  12. WORKDIR /staging
  13. RUN chown 1000:1000 /staging
  14. # Copy across the scripts folder
  15. COPY scripts/* ./scripts/
  16. # Set permissions for all scripts. We do not want normal users to have write
  17. # access to the scripts
  18. RUN chown -R 0:0 scripts
  19. RUN chmod -R 755 scripts
  20. # Build the image. This build runs as root
  21. RUN /staging/scripts/1-image-build.sh
  22. #####
  23. ## Second Image
  24. #####
  25. FROM alpine:latest
  26. #environment variables
  27. ENV PROJECT_NAME="headscale-ui"
  28. # URL for the github/git location
  29. ENV PROJECT_URL="https://github.com/gurucomputing/headscale-ui"
  30. # Ports that caddy will run on
  31. ENV HTTP_PORT="80"
  32. ENV HTTPS_PORT="443"
  33. # Production Web Server port. Runs a self signed SSL certificate
  34. EXPOSE 443
  35. # Set the staging environment
  36. WORKDIR /data
  37. WORKDIR /web
  38. WORKDIR /staging/scripts
  39. WORKDIR /staging
  40. # Copy across the scripts folder
  41. COPY scripts/* ./scripts/
  42. # Copy default caddy config from project root
  43. COPY ./Caddyfile /staging/Caddyfile
  44. COPY --from=build /staging/${PROJECT_NAME}/build /web
  45. RUN apk add --no-cache caddy
  46. # Create a group and user
  47. RUN addgroup -S appgroup && adduser -D appuser -G appgroup
  48. # Set permissions for all scripts. We do not want normal users to have write
  49. # access to the scripts
  50. RUN chown -R 0:0 scripts
  51. RUN chmod -R 755 scripts
  52. RUN chown -R appuser:appgroup /web
  53. RUN chown -R appuser:appgroup /data
  54. # Tell docker that all future commands should run as the appuser user
  55. USER appuser
  56. WORKDIR /data
  57. ENTRYPOINT /bin/sh /staging/scripts/2-initialise.sh