Skip to content

Commit f4fcd82

Browse files
authored
[dockerhub] Added action for publishing docker image (#1421)
## Summary added an action to build and publish an image containing devbox and nix installations to dockerhub ## How was it tested? Not tested yet
1 parent 63dcf0c commit f4fcd82

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: docker-image-release
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
docker-image-build-push:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Check out the repo
10+
uses: actions/checkout@v3
11+
- name: Set up Docker Buildx
12+
uses: docker/setup-buildx-action@v2
13+
- name: Login to Docker Hub
14+
uses: docker/login-action@v2
15+
with:
16+
username: ${{ secrets.DOCKERHUB_USERNAME }}
17+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
18+
- name: Build and push default
19+
uses: docker/build-push-action@v4
20+
with:
21+
context: ./internal/impl/generate/tmpl/
22+
file: ./internal/impl/generate/tmpl/DevboxImageDockerfile
23+
push: true
24+
tags: jetpackio/devbox:latest
25+
- name: Build and push root user
26+
uses: docker/build-push-action@v4
27+
with:
28+
context: ./internal/impl/generate/tmpl/
29+
file: ./internal/impl/generate/tmpl/DevboxImageDockerfileRootUser
30+
push: true
31+
tags: jetpackio/devbox-root-user:latest
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM debian:stable-slim
2+
3+
# Step 1: Installing dependencies
4+
RUN apt-get update
5+
RUN apt-get -y install bash binutils git xz-utils wget sudo
6+
7+
# Step 1.5: Setting up devbox user
8+
ENV DEVBOX_USER=devbox
9+
RUN adduser $DEVBOX_USER
10+
RUN usermod -aG sudo $DEVBOX_USER
11+
RUN echo "devbox ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$DEVBOX_USER
12+
USER $DEVBOX_USER
13+
14+
# Step 2: Installing Nix
15+
RUN wget --output-document=/dev/stdout https://nixos.org/nix/install | sh -s -- --no-daemon
16+
RUN . ~/.nix-profile/etc/profile.d/nix.sh
17+
18+
ENV PATH="/home/${DEVBOX_USER}/.nix-profile/bin:$PATH"
19+
20+
# Step 3: Installing devbox
21+
RUN wget --quiet --output-document=/dev/stdout https://get.jetpack.io/devbox | bash -s -- -f
22+
RUN chown -R "${DEVBOX_USER}:${DEVBOX_USER}" /usr/local/bin/devbox
23+
24+
CMD ["devbox", "version"]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM debian:stable-slim
2+
3+
# Step 1: Installing dependencies
4+
RUN apt-get update
5+
RUN apt-get -y install bash binutils git xz-utils wget sudo
6+
7+
# Step 2: Installing Nix
8+
RUN wget --output-document=/dev/stdout https://nixos.org/nix/install | sh -s -- --daemon
9+
RUN . ~/.nix-profile/etc/profile.d/nix.sh
10+
11+
ENV PATH="/root/.nix-profile/bin:$PATH"
12+
13+
# Step 3: Installing devbox
14+
RUN wget --quiet --output-document=/dev/stdout https://get.jetpack.io/devbox | bash -s -- -f
15+
16+
CMD ["devbox", "version"]

0 commit comments

Comments
 (0)