]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
add dockerfile and docker-compose file
authorRudra-IITM <singhrudra5556@gmail.com>
Fri, 5 Apr 2024 17:00:54 +0000 (22:30 +0530)
committerRudra-IITM <singhrudra5556@gmail.com>
Fri, 5 Apr 2024 17:00:54 +0000 (22:30 +0530)
.dockerignore [new file with mode: 0644]
.gitignore
Dockerfile [new file with mode: 0644]
INSTALL.md
docker-compose.yaml [new file with mode: 0644]

diff --git a/.dockerignore b/.dockerignore
new file mode 100644 (file)
index 0000000..89c105f
--- /dev/null
@@ -0,0 +1,35 @@
+# Include any files or directories that you don't want to be copied to your
+# container here (e.g., local build artifacts, temporary files, etc.).
+#
+# For more help, visit the .dockerignore file reference guide at
+# https://docs.docker.com/go/build-context-dockerignore/
+
+**/.DS_Store
+**/__pycache__
+**/.venv
+**/.classpath
+**/.dockerignore
+**/.env
+**/.git
+**/.gitignore
+**/.project
+**/.settings
+**/.toolstarget
+**/.vs
+**/.vscode
+**/*.*proj.user
+**/*.dbmdl
+**/*.jfm
+**/bin
+**/charts
+**/docker-compose*
+**/compose*
+**/Dockerfile*
+**/node_modules
+**/npm-debug.log
+**/obj
+**/secrets.dev.yaml
+**/values.dev.yaml
+LICENSE
+README.md
+container-config
index 1ebc7616b3a3c8205ed86f1283990b8ca4d7e492..9767410098a909bed057c5ffa40ccc1ab9af3da3 100644 (file)
 /vcnet/x64
 /xcode/CUPS.xcodeproj/project.xcworkspace/
 /xcode/CUPS.xcodeproj/xcuserdata/
-
+.DS_store
+container-config
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..a8f2dfc
--- /dev/null
@@ -0,0 +1,31 @@
+# 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
+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 \
+    sudo
+
+# Copy the current directory contents into the container's working directory
+COPY . .
+
+# Expose port 631 for CUPS web interface
+EXPOSE 631
index 452baadd662eef9f8484cd4faeae67db78b46c59..0b6f113dfa2800e3ce0a3006b495df3155a1c85a 100644 (file)
@@ -185,3 +185,29 @@ logging:
   the messages to stderr.  Prefix a filename with "+" to append to an existing
   file.  You can include a single "%d" in the filename to embed the current
   process ID.
+
+Build Using Docker
+------------------
+
+### Prerequisites
+
+- Docker installed on your system
+
+### Build and Run
+
+To build and run CUPS using Docker, follow these steps:
+
+1. Clone this repository to your local machine.
+
+2. Navigate to the root directory of the cloned repository.
+
+3. Run the following command to start the Docker containers in the background:
+
+   ```bash
+   docker-compose up -d
+   ```
+
+4. To start interactive terminal in container
+    ```bash
+    docker exec -it cups /bin/bash
+    ```
diff --git a/docker-compose.yaml b/docker-compose.yaml
new file mode 100644 (file)
index 0000000..b530a67
--- /dev/null
@@ -0,0 +1,48 @@
+version: "3.8"
+
+services:
+  cups:
+    build:
+      context: .
+      dockerfile: Dockerfile
+    container_name: cups
+    # Command to be executed when the container starts
+    command:
+      - /bin/bash
+      - -c
+      - |
+        # Add a new user 'admin' with password 'admin'
+        useradd -m --create-home --password $(echo 'admin' | openssl passwd -1 -stdin) -f 0 admin
+
+        # Create a new group 'lpadmin'
+        groupadd lpadmin
+
+        # Add the user 'admin' to the 'lpadmin' group
+        usermod -aG lpadmin admin
+
+        # Grant sudo privileges to the user 'admin'
+        echo 'admin ALL=(ALL:ALL) ALL' >> /etc/sudoers
+
+        # build CUPS
+        ./configure
+        make
+        make install
+
+        # Start the CUPS daemon for remote access
+        /usr/sbin/cupsd \
+        && while [ ! -f /var/run/cups/cupsd.pid ]; do sleep 1; done \
+        && cupsctl --remote-admin --remote-any --share-printers \
+        && kill $(cat /var/run/cups/cupsd.pid) \
+        && echo "ServerAlias *" >> /etc/cups/cupsd.conf \
+        && service cups start \
+        && /usr/sbin/cupsd -f
+
+    # Expose port 631 for CUPS web interface
+    ports:
+      - "631:631"
+
+    # Bind mount for cups config files and logs
+    volumes:
+      - .:/workspaces/cups
+      - ./container-config:/etc/cups
+      - ./container-config/logs:/var/log/cups