-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
67 lines (55 loc) · 2.03 KB
/
Dockerfile
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
56
57
58
59
60
61
62
63
64
65
66
67
FROM ubuntu
LABEL org.opencontainers.image.title="Datastore emulator"
LABEL org.opencontainers.image.authors="[email protected]"
LABEL org.opencontainers.image.source=https://github.com/marcos-wz/datastore-emulator
LABEL org.opencontainers.image.description="GCP Datastore emulator based on ubuntu"
# SETUP ---------------------------------------------------------------------
ARG DS_USER="dsuser"
ARG DS_HOME="/home/${DS_USER}"
RUN set -eux \
&& DEBIAN_FRONTEND=noninteractive apt --yes -qq update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends -qq \
curl \
default-jre \
# CREATE USER
&& useradd --comment "datastore emulator user" \
--create-home \
--home-dir ${DS_HOME} \
${DS_USER} \
# CLEAN INSTALLATION
&& DEBIAN_FRONTEND=noninteractive apt-get autoremove --yes -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get -qq clean \
&& rm -fr /var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
~/.cache
# INSTALL EMULATOR --------------------------------------------------------------------
USER ${DS_USER}
ARG PORT="8081"
ARG GCLOUD_ARCH="x86_64"
ARG GCLOUD_VERSION="458.0.1"
ARG GCLOUD_FILE="google-cloud-cli-${GCLOUD_VERSION}-linux-${GCLOUD_ARCH}.tar.gz"
ENV CLOUDSDK_CORE_PROJECT="test-project"
ENV DS_HOST="0.0.0.0"
ENV DS_PORT=${PORT}
ENV GCLOUD_DIR="${DS_HOME}/google-cloud-sdk"
ENV GCLOUD_STORE_ON_DISK=false
RUN <<EOT bash
set -eux
curl -sS -o ${DS_HOME}/${GCLOUD_FILE} https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/${GCLOUD_FILE}
tar -xf ${DS_HOME}/${GCLOUD_FILE} -C ${DS_HOME}/
rm -v ${DS_HOME}/${GCLOUD_FILE}
${GCLOUD_DIR}/install.sh \
--quiet \
--usage-reporting false \
--path-update true \
--command-completion true
source ${GCLOUD_DIR}/path.bash.inc
gcloud components install \
beta \
cloud-datastore-emulator \
--quiet
EOT
COPY ./entrypoint.sh /entrypoint.sh
EXPOSE ${PORT}
ENTRYPOINT [ "./entrypoint.sh" ]