-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (40 loc) · 2.01 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (40 loc) · 2.01 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
# syntax=docker/dockerfile:1.10
# enable docker linting
# check=error=true
ARG UBUNTU_VERSION=ubuntu:20.04
# we are parameterizing the base image, so we can't be explicit like DL3006 wants us to be
# hadolint ignore=DL3006
FROM $UBUNTU_VERSION as base-docker
# default env vars
ENV container=docker DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 LC_ALL=C.UTF-8
# base metadata as per:
# https://github.com/opencontainers/image-spec/blob/master/annotations.md#pre-defined-annotation-keys
LABEL org.opencontainers.image.authors="tech@opensafely.org" \
org.opencontainers.image.url="opensafely.org" \
org.opencontainers.image.vendor="OpenSAFELY" \
org.opencontainers.image.source="https://github.com/opensafely-core/base-docker"
# useful utility for installing apt packages in the most space efficient way
# possible. It's worth it because this is the base image, and so any bloat
# here affects all our images. Plus, it's then available for downstream images
# to use.
COPY docker-apt-install.sh /root/docker-apt-install.sh
# install some base tools we want in all images
# Caching from docs: https://docs.docker.com/reference/dockerfile/#example-cache-apt-packages
# Enable full caching of apt packages and metadata, undoing the debian defaults.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
--mount=type=secret,id=ubuntu_pro_token <<EOF
rm -f /etc/apt/apt.conf.d/docker-clean
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
UPGRADE=yes /root/docker-apt-install.sh ca-certificates sysstat lsof net-tools tcpdump vim-tiny strace file
EOF
# record build info so downstream images know about the base image they were
# built from
ARG BASE_CREATED
ARG BASE_GITREF
LABEL org.opensafely.base.created=$BASE_CREATED \
org.opensafely.base.gitref=$BASE_GITREF
FROM base-docker as base-action
# special action entrypoint
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]