System configuration for OpenStack Infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.4KB

  1. # Copyright (c) 2018 Red Hat, Inc.
  2. # Copyright (c) 2016 The Gitea Authors
  3. # Copyright (c) 2015 The Gogs Authors
  4. #
  5. # Permission is hereby granted, free of charge, to any person obtaining a copy
  6. # of this software and associated documentation files (the "Software"), to deal
  7. # in the Software without restriction, including without limitation the rights
  8. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. # copies of the Software, and to permit persons to whom the Software is
  10. # furnished to do so, subject to the following conditions:
  11. #
  12. # The above copyright notice and this permission notice shall be included in
  13. # all copies or substantial portions of the Software.
  14. #
  15. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. # THE SOFTWARE.
  22. ###################################
  23. #Build stage
  24. FROM docker.io/library/golang:1.13-buster AS build-env
  25. LABEL maintainer="infra-root@openstack.org"
  26. ARG GITEA_VERSION="v1.10.2"
  27. ENV TAGS "bindata $TAGS"
  28. #Build deps
  29. RUN apt-get update && apt-get -y install build-essential git \
  30. && mkdir -p ${GOPATH}/src/code.gitea.io/gitea
  31. #Setup repo
  32. RUN git clone https://github.com/go-gitea/gitea ${GOPATH}/src/code.gitea.io/gitea
  33. WORKDIR ${GOPATH}/src/code.gitea.io/gitea
  34. #Checkout version if set
  35. RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
  36. && make clean generate build
  37. ###################################
  38. # Basic system setup common to all containers in our pod
  39. FROM docker.io/library/debian:buster-slim as base
  40. RUN apt-get update && apt-get -y install \
  41. bash \
  42. ca-certificates \
  43. curl \
  44. gettext \
  45. git \
  46. openssh-client \
  47. tzdata \
  48. && apt-get clean \
  49. && rm -rf /var/lib/apt/lists/*
  50. RUN addgroup --system --gid 1000 git \
  51. && adduser \
  52. --system --no-create-home --disabled-login \
  53. --home /data/git \
  54. --shell /bin/bash \
  55. --uid 1000 \
  56. --gid 1000 \
  57. git \
  58. && echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd \
  59. && mkdir /custom
  60. # Copy the /etc config files and entrypoint script
  61. COPY --from=build-env /go/src/code.gitea.io/gitea/docker/root /
  62. # Copy the app
  63. COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
  64. RUN ln -s /app/gitea/gitea /usr/local/bin/gitea
  65. # Copy our custom templates
  66. COPY custom/ /custom/
  67. ENV GITEA_CUSTOM /custom
  68. ###################################
  69. # The gitea image
  70. FROM base as gitea
  71. RUN apt-get update && apt-get -y install pandoc \
  72. && apt-get clean \
  73. && rm -rf /var/lib/apt/lists/*
  74. EXPOSE 3000
  75. ENV USER git
  76. VOLUME ["/data"]
  77. ENTRYPOINT ["/usr/bin/entrypoint"]
  78. CMD ["/app/gitea/gitea", "web"]
  79. USER 1000:1000
  80. ###################################
  81. # The openssh server image
  82. FROM base as gitea-openssh
  83. RUN apt-get update \
  84. && DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confold" \
  85. install openssh-server \
  86. && apt-get clean \
  87. && rm -rf /var/lib/apt/lists/* \
  88. && mkdir /run/sshd
  89. COPY sshd-entrypoint.sh /usr/bin/entrypoint
  90. EXPOSE 22
  91. VOLUME ["/data"]
  92. ENTRYPOINT ["/usr/bin/entrypoint"]
  93. CMD ["/usr/sbin/sshd", "-D", "-e"]