Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (43 loc) · 2.5 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (43 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# keep this in sync with docker-images/prometheus/Dockerfile
FROM prom/prometheus:v2.15.2@sha256:35c52c0c2b76433bbfc44a5a7abc294c2f032ed80250be02b441db5dd91b203a AS prometheus
FROM alpine:3.10@sha256:e4355b66995c96b4b468159fc5c7e3540fcef961189ca13fee877798649f531a AS precise-code-intel-builder
RUN apk add --no-cache \
nodejs-current=12.4.0-r0 \
nodejs-npm=10.19.0-r0
RUN npm install -g yarn@1.17.3
COPY precise-code-intel/package.json precise-code-intel/yarn.lock precise-code-intel/tsconfig.json /precise-code-intel/
RUN yarn --cwd /precise-code-intel
COPY precise-code-intel/src /precise-code-intel/src
RUN yarn --cwd /precise-code-intel run build
FROM sourcegraph/alpine:3.10@sha256:4d05cd5669726fc38823e92320659a6d1ef7879e62268adec5df658a0bacf65c
ARG COMMIT_SHA="unknown"
ARG DATE="unknown"
ARG VERSION="unknown"
LABEL org.opencontainers.image.revision=${COMMIT_SHA}
LABEL org.opencontainers.image.created=${DATE}
LABEL org.opencontainers.image.version=${VERSION}
LABEL com.sourcegraph.github.url=https://github.com/sourcegraph/sourcegraph/commit/${COMMIT_SHA}
# environment variables used by startup
ENV PROMETHEUS_STORAGE_DIR=/prometheus
ENV PROMETHEUS_CONFIGURATION_DIR=/prometheus_config
# hadolint ignore=DL3018
RUN apk update && apk add --no-cache \
nodejs-current=12.4.0-r0 \
tini
USER root
RUN mkdir -p $PROMETHEUS_STORAGE_DIR && chown -R sourcegraph:sourcegraph $PROMETHEUS_STORAGE_DIR
RUN mkdir -p $PROMETHEUS_CONFIGURATION_DIR && chown -R sourcegraph:sourcegraph $PROMETHEUS_CONFIGURATION_DIR
# Ensures that a directory with the correct permissions exist in the image. Without this, in Docker Compose
# deployments the Docker daemon would first create the volume directory and it would be owned by `root` and
# then one of the precise-code-intel processes would be unable to create the `/lsif-storage` because it
# would be trying to do so in a directory owned by `root` as the user `sourcegraph`. And no, this is not
# dumb, this is just Docker: https://github.com/docker/compose/issues/3270#issuecomment-363478501.
RUN mkdir -p /lsif-storage && chown -R sourcegraph:sourcegraph /lsif-storage
USER sourcegraph
COPY --from=precise-code-intel-builder /precise-code-intel /precise-code-intel
COPY ./supervisor /usr/local/bin/supervisor
COPY --from=prometheus /bin/prometheus /bin/prometheus
COPY ./precise-code-intel/worker/prometheus.yml $PROMETHEUS_CONFIGURATION_DIR/prometheus.yml
EXPOSE 3188 9090
ENV GO111MODULES=on LANG=en_US.utf8 LOG_LEVEL=debug
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/supervisor"]