diff --git a/tools/docker/images/Dockerfile b/tools/docker/images/Dockerfile index 8d81ff41..9d489ef1 100644 --- a/tools/docker/images/Dockerfile +++ b/tools/docker/images/Dockerfile @@ -14,7 +14,7 @@ RUN npm ci COPY . . RUN npm run production -FROM nginx AS nginx +FROM nginx AS production COPY tools/docker/images/nginx/root / WORKDIR /app COPY --from=app /app/output_prod ./ diff --git a/workspace.yml b/workspace.yml index 97b0d99f..0647163f 100644 --- a/workspace.yml +++ b/workspace.yml @@ -1,6 +1,9 @@ workspace('oliverdavies-uk'): description: Sculpin website for oliverdavies.uk. +attribute('docker'): + repository: ghcr.io/opdavies/oliverdavies-uk-web + command('disable'): env: COMPOSE_PROJECT_NAME: = @('namespace') @@ -13,9 +16,20 @@ command('docker image build '): COMPOSE_PROJECT_NAME: = @('namespace') GIT_COMMIT_SHA: = input.argument('git_commit') exec: | - #!bash(workspace:/) - docker image build -f tools/docker/images/Dockerfile -t ${COMPOSE_PROJECT_NAME}-web:latest --target=nginx . - docker image build -f tools/docker/images/Dockerfile -t ${COMPOSE_PROJECT_NAME}-web:${GIT_COMMIT_SHA} --target=nginx . + #!bash(workspace:/)|@ + run docker image build -f tools/docker/images/Dockerfile --target=production -t @('docker.repository'):${GIT_COMMIT_SHA} . + run docker image build -f tools/docker/images/Dockerfile --target=production -t @('docker.repository'):latest . + +command('docker image push '): + env: + COMPOSE_PROJECT_NAME: = @('namespace') + GIT_COMMIT_SHA: = input.argument('git_commit') + exec: | + #!bash(workspace:/)|@ + ws docker image build $GIT_COMMIT_SHA + + run docker push @('docker.repository'):${GIT_COMMIT_SHA} + run docker push @('docker.repository'):latest command('enable'): env: