-
Notifications
You must be signed in to change notification settings - Fork 146
/
Dockerfile.worker
47 lines (35 loc) · 1.6 KB
/
Dockerfile.worker
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
FROM gcr.io/google-containers/debian-base-amd64:v2.0.0
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y unzip ca-certificates curl bash git xz-utils && \
rm -rf /var/lib/apt/lists/*
ENV PUB_ENVIRONMENT="bot.pub_dev.pub_worker"
ENV CI="true"
ENV NO_COLOR="true"
# Configure a 'worker' user, to avoid running processes as root when this is not
# necessary (this is just docker hardening).
RUN groupadd -r worker -g 2000 && useradd --no-log-init -r -m -g worker worker
USER worker:2000
# Install pub-dev
COPY --chown=worker:worker . /home/worker/pub-dev
WORKDIR /home/worker/pub-dev
# A config directory for preview SDKs.
RUN mkdir -p /home/worker/config/dart-stable
RUN mkdir -p /home/worker/config/flutter-stable
# Setup Dart SDK into /home/worker/dart/{stable,preview}/
RUN XDG_CONFIG_HOME=/home/worker/config/dart-stable tool/setup-dart.sh /home/worker/dart/stable 3.5.4
# Setup Flutter SDK into /home/worker/flutter/{stable,preview}/
RUN XDG_CONFIG_HOME=/home/worker/config/flutter-stable tool/setup-flutter.sh /home/worker/flutter/stable 3.24.5
# Setup webp
RUN tool/setup-webp.sh /home/worker/bin
# Configure SDKs to be used for analysis
ENV DART_SDK="/home/worker/dart/stable"
ENV FLUTTER_ROOT="/home/worker/flutter/stable"
# Use stable Dart-SDK in PATH
ENV PATH="/home/worker/bin:/home/worker/dart/stable/bin:${PATH}"
# Install dependencies for pub_worker
WORKDIR /home/worker/pub-dev/pkg/pub_worker
RUN dart pub get
# This container image is launched by cloud-init, and cloud-init is responsible
# for shutting down the VM when the container exits.
ENTRYPOINT ["dart", "bin/pub_worker.dart"]