Skip to content

Commit

Permalink
Test 1
Browse files Browse the repository at this point in the history
  • Loading branch information
PiyushXCoder committed Dec 6, 2023
1 parent 508cfd7 commit 3909285
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 47 deletions.
25 changes: 0 additions & 25 deletions .Dockerfile

This file was deleted.

12 changes: 0 additions & 12 deletions .docker-compose.yml

This file was deleted.

1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/target
/etc
9 changes: 2 additions & 7 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@ on:
branches:
- "main"
- "PiyushXCoder-workflow"
# pull_request:
# branches:
# - "main"

jobs:
push-store-image:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main

- name: 'List'
run: ls

- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
Expand All @@ -28,6 +22,7 @@ jobs:

- name: 'Build Inventory Image'
run: |
docker build . --tag ghcr.io/${GITHUB_REPOSITORY,,}:main
docker buildx build . --load --platform linux/arm64 --build-arg="RUNNER_GROUP_ID=${RUNNER_GROUP_ID}" \
--build-arg="RUNNER_USER_ID=${RUNNER_USER_ID}" --build-arg="APP=${APP}" -t --tag ghcr.io/${GITHUB_REPOSITORY,,}:main
docker push ghcr.io/${GITHUB_REPOSITORY,,}:main
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/target
/Dockerfile
/etc/config.json
/localhost-key.pem
/localhost.pem
/docker-compose.yml
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM rust:alpine3.18 AS build

RUN apk add --no-cache musl-dev pkgconfig openssl-dev

WORKDIR /app
COPY . .

RUN cargo build --release




FROM alpine:3.18

ARG RUNNER_GROUP_ID=local
ENV RUNNER_GROUP_ID=${RUNNER_GROUP_ID}

ARG RUNNER_USER_ID=local
ENV RUNNER_USER_ID=${RUNNER_USER_ID}

ARG APP=local
ENV APP=${APP}

RUN apk add --no-cache openssl

RUN addgroup -g ${RUNNER_GROUP_ID} runner && adduser -G runner -u ${RUNNER_USER_ID} runner -D
USER runner

COPY --from=build --chown=runner:runner /app/target/release/${APP} /app/app
COPY --from=build --chown=runner:runner /app/static /app/static

WORKDIR /app

CMD ./app --bind-address 0.0.0.0 --port 8000 --config-file /app/config.json --static-path /app/static
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

version: "3.2"
services:
web:
build:
context: .
args:
RUNNER_USER_ID: ${RUNNER_USER_ID}
RUNNER_GROUP_ID: ${RUNNER_GROUP_ID}
APP: ${APP}

ports:
- ${PORT}:8080
volumes:
- ${CONFIG}:/app/config.json

0 comments on commit 3909285

Please sign in to comment.