-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.devcontainer
46 lines (37 loc) · 1.79 KB
/
Dockerfile.devcontainer
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
# Copyright (c) 2022 to 2024 MobileCoin Inc.
# hadolint global ignore=DL3008, DL3015, DL3007
# Update fat-devcontainer for use as a devcontainer
# Set BASE_IMAGE as fat-builder or fat-sgx-builder image and Name/Tag the image
# "FROM mobilecoin/fat-builder:latest" as mobilecoin/fat-devcontainer:latest
# "FROM mobilecoin/fat-sgx-build:latest" as mobilecoin/fat-sgx-devcontainer:latest
ARG BASE_IMAGE=fat-builder
ARG BASE_IMAGE_TAG=latest
FROM mobilecoin/${BASE_IMAGE}:${BASE_IMAGE_TAG} AS base
ARG TARGETARCH
ARG USERNAME=sentz
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create the user
RUN userdel -r ubuntu \
&& groupadd --gid "${USER_GID}" "${USERNAME}" \
&& useradd --uid "${USER_UID}" --gid "${USER_GID}" -m "${USERNAME}" -s /bin/bash \
&& echo "${USERNAME} ALL=(root) NOPASSWD:ALL" > "/etc/sudoers.d/${USERNAME}" \
&& chmod 0440 "/etc/sudoers.d/${USERNAME}" \
&& chown -R sentz:sentz /opt \
&& mkdir -p /home/sentz/.config/pip \
&& echo "[global]" >> /home/sentz/.config/pip/pip.conf \
&& echo "break-system-packages = true" >> /home/sentz/.config/pip/pip.conf \
&& chown -R sentz:sentz /home/sentz
COPY startup-devcontainer.sh /usr/local/bin/startup-devcontainer.sh
# This squashes the image - why this kludge of a solution docker ???
# a plain --squash flag wasn't good enough
FROM scratch AS final
COPY --from=base / /
# If you squash this way we loose all the env vars from the base image
ENV RUSTUP_HOME=/opt/rustup
ENV CARGO_HOME=/opt/cargo
ENV GOPATH=/opt/go/
ENV PATH="/home/sentz/.local/bin:/opt/cargo/bin:/usr/local/go/bin:${GOPATH}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/intel/sgxsdk/bin:/opt/intel/sgxsdk/bin/x64"
ENV SGX_SDK=/opt/intel/sgxsdk
ENV PKG_CONFIG_PATH=/opt/intel/sgxsdk/pkgconfig
ENV LD_LIBRARY_PATH=/opt/intel/sgxsdk/sdk_libs