-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
84 lines (69 loc) · 2.56 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# --------------------------------------------------------------------------------
# Docker configuration for P4D
# --------------------------------------------------------------------------------
FROM ubuntu:focal
LABEL vendor="Sourcegraph"
LABEL maintainer="Joe Chen (joe@sourcegraph.com)"
# Update Ubuntu and add Perforce Package Source
RUN apt-get update && \
apt-get install -y wget gnupg2 && \
wget -qO - https://package.perforce.com/perforce.pubkey | apt-key add - && \
echo "deb http://package.perforce.com/apt/ubuntu focal release" > /etc/apt/sources.list.d/perforce.list && \
apt-get update
# --------------------------------------------------------------------------------
# Docker BUILD
# --------------------------------------------------------------------------------
# Create perforce user and install Perforce Server
# Do in-page search over https://package.perforce.com/apt/ubuntu/dists/focal/release/binary-amd64/Packages
# for both "Package: helix-p4d" and "Package: helix-swarm-triggers".
RUN apt-get update && apt-get install -y helix-p4d=2024.1-2625008~focal helix-swarm-triggers=2024.3-2628402~focal
# Add external files
COPY files/restore.sh /usr/local/bin/restore.sh
COPY files/setup.sh /usr/local/bin/setup.sh
COPY files/init.sh /usr/local/bin/init.sh
COPY files/latest_checkpoint.sh /usr/local/bin/latest_checkpoint.sh
RUN \
chmod +x /usr/local/bin/restore.sh && \
chmod +x /usr/local/bin/setup.sh && \
chmod +x /usr/local/bin/init.sh && \
chmod +x /usr/local/bin/latest_checkpoint.sh
# --------------------------------------------------------------------------------
# Docker ENVIRONMENT
# --------------------------------------------------------------------------------
# Default Environment
ARG NAME=perforce-server
ARG P4NAME=master
ARG P4TCP=1666
ARG P4USER=admin
ARG P4PASSWD=pass12349ers
ARG P4CASE=-C0
ARG P4CHARSET=utf8
# Dynamic Environment
ENV NAME=$NAME \
P4NAME=$P4NAME \
P4TCP=$P4TCP \
P4PORT=$P4TCP \
P4USER=$P4USER \
P4PASSWD=$P4PASSWD \
P4CASE=$P4CASE \
P4CHARSET=$P4CHARSET \
JNL_PREFIX=$P4NAME
# Base Environment
ENV P4HOME=/p4
# Derived Environment
ENV P4ROOT=$P4HOME/root \
P4DEPOTS=$P4HOME/depots \
P4CKP=$P4HOME/checkpoints
# Expose Perforce; TCP port and volumes
EXPOSE $P4TCP
VOLUME $P4HOME
# --------------------------------------------------------------------------------
# Docker RUN
# --------------------------------------------------------------------------------
ENTRYPOINT \
init.sh && \
/usr/bin/tail -F $P4ROOT/logs/log
HEALTHCHECK \
--interval=2m \
--timeout=10s \
CMD p4 info -s > /dev/null || exit 1