forked from OpenPrinting/cups
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
60 lines (49 loc) · 1.52 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
# syntax=docker/dockerfile:1
# Use the latest Ubuntu base image
FROM ubuntu:latest
# Set the working directory inside the container
WORKDIR /workspaces/cups
# Update package list and upgrade existing packages
RUN apt-get update -y && apt-get upgrade -y
# Install required dependencies for CUPS and openssl for password encryption
RUN apt-get install -y \
autoconf \
build-essential \
libavahi-client-dev \
libgnutls28-dev \
libkrb5-dev \
libnss-mdns \
libpam-dev \
libsystemd-dev \
libusb-1.0-0-dev \
zlib1g-dev \
openssl \
apt-utils \
libpam0g-dev \
libdbus-1-dev \
libssl-dev \
libcups2 \
libcups2-dev \
sudo
# Create a new user 'admin' with password 'admin'
# Generate the encrypted password and store it in a variable
RUN echo 'admin' | openssl passwd -1 -stdin > /tmp/passwd.txt && \
useradd -m --create-home --password `cat /tmp/passwd.txt` admin && \
rm /tmp/passwd.txt
# Create a new group 'lpadmin'
RUN groupadd lpadmin
# Add the user 'admin' to the 'lpadmin' group
RUN usermod -aG lpadmin admin
# Grant sudo privileges to the user 'admin'
RUN echo 'admin ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers
# Copy the current directory contents into the container's working directory
COPY . .
#添加执行权限
RUN chmod +x configure
RUN chmod +x /workspaces/cups/install-sh
# Build and install CUPS
RUN ./configure && make && make install
# Expose port 631 for CUPS web interface
EXPOSE 631
# Start the CUPS daemon for remote access
CMD ["/usr/sbin/cupsd", "-f"]