Skip to content

Commit

Permalink
Add proxy build args to Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikmonsen committed Apr 19, 2024
1 parent f118229 commit 5b6d9eb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
47 changes: 25 additions & 22 deletions .github/workflows/ci_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ jobs:
- name: Build application
run: npm run build

- name: Cache node_modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node_modules-

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: next-build
path: .next
# - name: Cache node_modules
# uses: actions/cache@v4
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
# restore-keys: ${{ runner.os }}-node_modules-
#
# - name: Upload build artifact
# uses: actions/upload-artifact@v4
# with:
# name: next-build
# path: .next

build-and-publish:
name: Create and push Docker image
Expand All @@ -63,16 +63,16 @@ jobs:
with:
driver: docker

- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-

- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: next-build
# - name: Restore node_modules from cache
# uses: actions/cache@v4
# with:
# path: node_modules
# key: ${{ runner.os }}-node_modules-
#
# - name: Download build artifact
# uses: actions/download-artifact@v4
# with:
# name: next-build

- name: Import secrets
id: import-secrets
Expand Down Expand Up @@ -110,6 +110,9 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: Dockerfile
build-args: |
HTTP_PROXY=${{ secrets.HTTP_PROXY }}
HTTPS_PROXY=${{ secrets.HTTPS_PROXY }}
deploy-to-stage:
name: Deploy stage environment
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
FROM node:20-alpine AS base

FROM base AS deps

ARG HTTP_PROXY
ARG HTTPS_PROXY
ENV HTTP_PROXY=$HTTP_PROXY
ENV HTTPS_PROXY=$HTTPS_PROXY

RUN apk add --no-cache libc6-compat
WORKDIR /app

Expand Down

0 comments on commit 5b6d9eb

Please sign in to comment.